blob: 61b9f49ef8c2a3046465d7db3906f0eca7a8e5dc [file] [log] [blame]
library test;
//
// Problems in library:
//
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:48:7: Error: The return type of the method 'M.y' is 'int', which does not match the return type of the overridden method, 'Object'.
// - 'Object' is from 'dart:core'.
// Change to a subtype of 'Object'.
// int y;
// ^
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:43:12: Context: This is the overridden method ('y').
// void set y(covariant Object /*@covariance=explicit*/ value);
// ^
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:54:5: Context: Override was introduced in the mixin application class 'C'.
// C = B with M implements I<int>;
// ^
//
import self as self;
import "dart:core" as core;
class B extends core::Object {
synthetic constructor •() self::B
: super core::Object::•()
;
get x() core::int {
throw "Should not be reached";
}
set x(core::int value) void {
throw "Should not be reached";
}
get y() core::int {
throw "Should not be reached";
}
set y(core::int 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;
abstract set x(generic-covariant-impl self::I::T value) void;
abstract get y() core::Object;
abstract set y(covariant core::Object value) void;
}
class M extends core::Object {
field core::int x = null;
field core::int y = null;
synthetic constructor •() self::M
: super core::Object::•()
;
}
class C = self::B with self::M implements self::I<core::int> {
synthetic constructor •() self::C
: super self::B::•()
;
forwarding-stub set y(covariant core::Object value) void
return super.{self::B::y} = value;
forwarding-stub set x(generic-covariant-impl core::int _) void
return super.{self::B::x} = _;
}
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> i) void {
self::expectTypeError(() core::Null {
i.{self::I::x} = "hello";
});
i.{self::I::x} = 1;
self::expect(i.{self::I::x}, 1);
self::expectTypeError(() core::Null {
i.{self::I::y} = "hello";
});
i.{self::I::y} = 2;
self::expect(i.{self::I::y}, 2);
}
static method main() void {
self::test(new self::C::•());
}