| // Formatted problems: |
| // |
| // pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart:39:9: Error: The return type of the method 'M::x' is (test::C::T) → void, which does not match the return type of the overridden method ((dart.core::int) → void). |
| // Change to a subtype of (dart.core::int) → void. |
| // T get x => f(); |
| // ^ |
| // pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart:24:14: Context: This is the overridden method ('x'). |
| // F<int> get x { |
| // ^ |
| // pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart:47:16: Context: Override was introduced in the mixin application class 'C'. |
| // abstract class C<T> = B with M<F<T>> implements I<T>; |
| // ^ |
| |
| // Unhandled errors: |
| // |
| // pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart:39:9: Error: The return type of the method 'M::x' is (test::C::T) → void, which does not match the return type of the overridden method ((dart.core::int) → void). |
| // Change to a subtype of (dart.core::int) → void. |
| // T get x => f(); |
| // ^ |
| |
| library test; |
| import self as self; |
| import "dart:core" as core; |
| |
| typedef F<T extends core::Object = dynamic> = (T) → void; |
| class B extends core::Object { |
| synthetic constructor •() → self::B |
| : super core::Object::•() |
| ; |
| get x() → (core::int) → void { |
| throw "Should not be reached"; |
| } |
| set x(core::Object value) → void { |
| throw "Should not be reached"; |
| } |
| } |
| abstract class I<T extends core::Object = dynamic> extends core::Object { |
| synthetic constructor •() → self::I<self::I::T> |
| : super core::Object::•() |
| ; |
| abstract get x() → (self::I::T) → void; |
| abstract set x(core::Object value) → void; |
| } |
| abstract class M<T extends core::Object = dynamic> extends core::Object { |
| synthetic constructor •() → self::M<self::M::T> |
| : super core::Object::•() |
| ; |
| get x() → self::M::T |
| return this.{self::M::f}(); |
| set x(core::Object value) → void { |
| throw "Should not be reached"; |
| } |
| abstract method f() → self::M::T; |
| } |
| abstract class C<T extends core::Object = dynamic> = self::B with self::M<(self::C::T) → void> implements self::I<self::C::T> { |
| synthetic constructor •() → self::C<self::C::T> |
| : super self::B::•() |
| ; |
| } |
| class D extends self::C<core::int> { |
| synthetic constructor •() → self::D |
| : super self::B::•() |
| ; |
| method f() → (core::int) → void |
| return (core::int i) → core::Null { |
| self::expect(i, 1); |
| }; |
| } |
| static method expectTypeError(() → void callback) → void { |
| try { |
| callback.call(); |
| throw "Expected TypeError, did not occur"; |
| } |
| on core::TypeError catch(no-exception-var) { |
| } |
| } |
| static method expect(core::Object value, core::Object expected) → void { |
| if(!value.{core::Object::==}(expected)) { |
| throw "Expected ${expected}, got ${value}"; |
| } |
| } |
| static method test(self::I<core::Object> iObj, self::I<core::int> iInt) → void { |
| self::expectTypeError(() → core::Null { |
| (core::Object) → void x = iObj.{self::I::x} as{TypeError} (core::Object) → void; |
| }); |
| (core::int) → void x = iInt.{self::I::x} as{TypeError} (core::int) → void; |
| x.call(1); |
| } |
| static method main() → void { |
| self::D d = new self::D::•(); |
| self::test(d, d); |
| } |