| library test /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| // s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.y*/ y; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:24:32: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't. |
| // s = new B(). /*@target=B.z*/ z; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:25:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| // s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.w*/ w; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:29:61: Error: A value of type 'String?' can't be assigned to a variable of type 'int'. |
| // i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.z*/ z; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class A extends core::Object { |
| field dynamic x = null; |
| field core::int y = 2; |
| field core::String? z = self::nullableString; |
| synthetic constructor •() → self::A |
| : super core::Object::•() |
| ; |
| } |
| class B extends core::Object implements self::A { |
| field dynamic x = 2; |
| field core::int y = 3; |
| field core::String? z = null; |
| field core::int w = 2; |
| synthetic constructor •() → self::B |
| : super core::Object::•() |
| ; |
| } |
| static field core::String? nullableString = "hi"; |
| static method foo() → dynamic { |
| core::String s; |
| core::int i; |
| s = new self::B::•().{self::B::x}{dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String; |
| s = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:23:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.y*/ y; |
| ^" in new self::B::•().{self::B::y}{core::int} as{TypeError,ForNonNullableByDefault} core::String; |
| s = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:24:32: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't. |
| s = new B(). /*@target=B.z*/ z; |
| ^" in new self::B::•().{self::B::z}{core::String?}; |
| s = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:25:61: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| s = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.w*/ w; |
| ^" in new self::B::•().{self::B::w}{core::int} as{TypeError,ForNonNullableByDefault} core::String; |
| i = new self::B::•().{self::B::x}{dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::int; |
| i = new self::B::•().{self::B::y}{core::int}; |
| i = invalid-expression "pkg/front_end/testcases/inference/infer_correctly_on_multiple_variables_declared_together.dart:29:61: Error: A value of type 'String?' can't be assigned to a variable of type 'int'. |
| i = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.z*/ z; |
| ^" in new self::B::•().{self::B::z}{core::String?} as{TypeError,ForNonNullableByDefault} core::int; |
| i = new self::B::•().{self::B::w}{core::int}; |
| } |
| static method main() → dynamic {} |