| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:19:22: Error: No named parameter with the name 'numLegs'. |
| // Cat firstCat = Cat(numLegs: 4, numWhiskers: 10); |
| // ^^^^^^^ |
| // pkg/front_end/testcases/value_class/super_type.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments. |
| // class Cat implements Animal { |
| // ^ |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:20:23: Error: No named parameter with the name 'numLegs'. |
| // Cat secondCat = Cat(numLegs: 4, numWhiskers: 10); |
| // ^^^^^^^ |
| // pkg/front_end/testcases/value_class/super_type.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments. |
| // class Cat implements Animal { |
| // ^ |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:21:22: Error: No named parameter with the name 'numLegs'. |
| // Cat thirdCat = Cat(numLegs: 4, numWhiskers: 0); |
| // ^^^^^^^ |
| // pkg/front_end/testcases/value_class/super_type.dart:13:7: Context: The class 'Cat' has a constructor that takes no arguments. |
| // class Cat implements Animal { |
| // ^ |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:9:13: Error: Final field 'numLegs' is not initialized. |
| // Try to initialize the field in the declaration or in every constructor. |
| // final int numLegs; |
| // ^^^^^^^ |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:14:13: Error: Final field 'numLegs' is not initialized. |
| // Try to initialize the field in the declaration or in every constructor. |
| // final int numLegs; |
| // ^^^^^^^ |
| // |
| // pkg/front_end/testcases/value_class/super_type.dart:15:13: Error: Final field 'numWhiskers' is not initialized. |
| // Try to initialize the field in the declaration or in every constructor. |
| // final int numWhiskers; |
| // ^^^^^^^^^^^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| @#C1 |
| class Animal extends core::Object { |
| final field core::int numLegs = null; |
| synthetic constructor •() → self::Animal |
| : super core::Object::•() |
| ; |
| } |
| @#C1 |
| class Cat extends core::Object implements self::Animal { |
| final field core::int numLegs = null; |
| final field core::int numWhiskers = null; |
| synthetic constructor •() → self::Cat |
| : super core::Object::•() |
| ; |
| } |
| static const field core::String valueClass = #C1; |
| static method main() → dynamic { |
| self::Cat firstCat = invalid-expression "pkg/front_end/testcases/value_class/super_type.dart:19:22: Error: No named parameter with the name 'numLegs'. |
| Cat firstCat = Cat(numLegs: 4, numWhiskers: 10); |
| ^^^^^^^"; |
| self::Cat secondCat = invalid-expression "pkg/front_end/testcases/value_class/super_type.dart:20:23: Error: No named parameter with the name 'numLegs'. |
| Cat secondCat = Cat(numLegs: 4, numWhiskers: 10); |
| ^^^^^^^"; |
| self::Cat thirdCat = invalid-expression "pkg/front_end/testcases/value_class/super_type.dart:21:22: Error: No named parameter with the name 'numLegs'. |
| Cat thirdCat = Cat(numLegs: 4, numWhiskers: 0); |
| ^^^^^^^"; |
| self::expect(true, firstCat.{core::Object::==}(secondCat)); |
| self::expect(false, firstCat.{core::Object::==}(thirdCat)); |
| self::expect(true, firstCat.{core::Object::hashCode}.{core::num::==}(secondCat.{core::Object::hashCode})); |
| self::expect(false, firstCat.{core::Object::hashCode}.{core::num::==}(thirdCat.{core::Object::hashCode})); |
| } |
| static method expect(dynamic expected, dynamic actual, [dynamic expectNull = #C2]) → dynamic { |
| if(expectNull as{TypeError,ForDynamic,ForNonNullableByDefault} core::bool) { |
| expected = null; |
| } |
| if(!expected.{core::Object::==}(actual)) { |
| throw "Mismatch: expected=${expected}, actual=${actual}"; |
| } |
| } |
| |
| constants { |
| #C1 = "valueClass" |
| #C2 = false |
| } |