blob: b14e415e4613ae1467e18f4696721832b9bf4534 [file] [log] [blame]
library test /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart:13:49: Error: The return type of the method 'B.x' is 'dynamic', which does not match the return type, 'int', of the overridden method, 'A.x'.
// Change to a subtype of 'int'.
// /*error:INVALID_METHOD_OVERRIDE*/ dynamic get x => 3;
// ^
// pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_infer.dart:9:11: Context: This is the overridden method ('x').
// final T x = throw '';
// ^
//
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 "";
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() dynamic
return 3;
}
static method foo() dynamic {
core::String y = new self::B::•().{self::B::x}{dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
core::int z = new self::B::•().{self::B::x}{dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
}
static method main() dynamic {
self::foo();
}