| library test /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be returned from a function with return type 'int'. |
| // get w => /*error:RETURN_OF_INVALID_TYPE*/ "hello"; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:68: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| // String y = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.x*/ x; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class A<T extends core::Object? = dynamic> extends core::Object { |
| final field self::A::T% x = throw ""; |
| final field self::A::T% w = throw ""; |
| synthetic constructor •() → self::A<self::A::T%> |
| : super core::Object::•() |
| ; |
| } |
| class B extends core::Object implements self::A<core::int> { |
| synthetic constructor •() → self::B |
| : super core::Object::•() |
| ; |
| get x() → core::int |
| return 3; |
| get w() → core::int |
| return invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:15:45: Error: A value of type 'String' can't be returned from a function with return type 'int'. |
| get w => /*error:RETURN_OF_INVALID_TYPE*/ \"hello\"; |
| ^" in "hello" as{TypeError,ForNonNullableByDefault} core::int; |
| } |
| static method foo() → dynamic { |
| core::String y = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_3.dart:19:68: Error: A value of type 'int' can't be assigned to a variable of type 'String'. |
| String y = /*error:INVALID_ASSIGNMENT*/ new B(). /*@target=B.x*/ x; |
| ^" in new self::B::•().{self::B::x}{core::int} as{TypeError,ForNonNullableByDefault} core::String; |
| core::int z = new self::B::•().{self::B::x}{core::int}; |
| } |
| static method main() → dynamic {} |