| // Errors: |
| // |
| // pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:14:64: Error: Declared type variables of 'D::m' doesn't match those on overridden method 'C::m'. |
| // /*@error=OverrideTypeMismatchReturnType*/ /*@topType=dynamic*/ m( |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/generic_methods_do_not_infer_invalid_override_of_generic_method.dart:14:64: Error: The return type of the method 'D::m' is dynamic, which does not match the return type of the overridden method (test::C::m::T). |
| // Change to a subtype of test::C::m::T. |
| // /*@error=OverrideTypeMismatchReturnType*/ /*@topType=dynamic*/ m( |
| // ^ |
| |
| library test; |
| import self as self; |
| import "dart:core" as core; |
| |
| class C extends core::Object { |
| synthetic constructor •() → void |
| : super core::Object::•() |
| ; |
| method m<T extends core::Object = dynamic>(self::C::m::T x) → self::C::m::T |
| return x; |
| } |
| class D extends self::C { |
| synthetic constructor •() → void |
| : super self::C::•() |
| ; |
| method m(dynamic x) → dynamic |
| return x; |
| } |
| static method main() → dynamic { |
| core::int y = new self::D::•().{self::D::m}<core::int>(42) as{TypeError} core::int; |
| core::print(y); |
| } |