blob: 2f222f6470c4c1c0cb3b250a912b7a2e3961a506 [file] [log] [blame]
library test;
//
// Problems in library:
//
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:51:7: Error: The mixin application class 'C' introduces an erroneous override of 'y'.
// class C = B with M implements I<int>;
// ^
// pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart:48:7: Context: The field 'M.y' has type 'int', which does not match the corresponding type, 'Object', in the overridden setter, 'I.y'.
// - 'Object' is from 'dart:core'.
// 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 value);
// ^
//
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 member-signature get _identityHashCode() core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) core::bool*; -> core::Object::==
abstract member-signature get hashCode() core::int*; -> core::Object::hashCode
abstract member-signature method toString() core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() core::Type*; -> core::Object::runtimeType
}
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;
abstract member-signature get _identityHashCode() core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) core::bool*; -> core::Object::==
abstract member-signature get hashCode() core::int*; -> core::Object::hashCode
abstract member-signature method toString() core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() core::Type*; -> core::Object::runtimeType
}
class M extends core::Object {
field core::int* x = null;
field core::int* y = null;
synthetic constructor •() self::M*
: super core::Object::•()
;
abstract member-signature get _identityHashCode() core::int*; -> core::Object::_identityHashCode
abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) core::bool*; -> core::Object::_instanceOf
abstract member-signature method _simpleInstanceOf(dynamic type) core::bool*; -> core::Object::_simpleInstanceOf
abstract member-signature method _simpleInstanceOfTrue(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfTrue
abstract member-signature method _simpleInstanceOfFalse(dynamic type) core::bool*; -> core::Object::_simpleInstanceOfFalse
abstract member-signature operator ==(dynamic other) core::bool*; -> core::Object::==
abstract member-signature get hashCode() core::int*; -> core::Object::hashCode
abstract member-signature method toString() core::String*; -> core::Object::toString
abstract member-signature method noSuchMethod(core::Invocation* invocation) dynamic; -> core::Object::noSuchMethod
abstract member-signature get runtimeType() core::Type*; -> core::Object::runtimeType
}
class C = self::B with self::M implements self::I<core::int*> {
synthetic constructor •() self::C*
: super self::B::•()
;
mixin-super-stub get x() core::int*
return super.{self::M::x};
forwarding-stub set x(generic-covariant-impl core::int* value) void
return super.{self::M::x} = value;
mixin-super-stub get y() core::int*
return super.{self::M::y};
forwarding-stub set y(covariant core::int* value) void
return super.{self::M::y} = value;
}
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(() Null {
i.{self::I::x} = "hello";
});
i.{self::I::x} = 1;
self::expect(i.{self::I::x}, 1);
self::expectTypeError(() 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::•());
}