mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:01:30 +00:00
ebb3dea075
R=ahe@google.com, paulberry@google.com, sigmund@google.com BUG= Review-Url: https://codereview.chromium.org/2981783002 .
51 lines
1.4 KiB
Text
51 lines
1.4 KiB
Text
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class C extends core::Object {
|
|
default constructor •() → void
|
|
: super core::Object::•()
|
|
;
|
|
set onlySetter(dynamic value) → void {
|
|
core::print("C.onlySetter called with ${value}.");
|
|
}
|
|
method testC() → dynamic {
|
|
try {
|
|
core::print(this.onlySetter);
|
|
throw "No error thrown";
|
|
}
|
|
on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
|
|
core::print("Expected error: ${e}");
|
|
}
|
|
this.onlySetter = "hest";
|
|
}
|
|
method testD() → dynamic {
|
|
core::print(this.onlySetter);
|
|
this.onlySetter = "hest";
|
|
}
|
|
}
|
|
class D extends self::C {
|
|
default constructor •() → void
|
|
: super self::C::•()
|
|
;
|
|
get onlySetter() → core::String
|
|
return "D.onlySetter called.";
|
|
set onlySetter(dynamic value) → void {
|
|
core::print("D.onlySetter called with ${value}.");
|
|
}
|
|
}
|
|
static set onlySetter(dynamic value) → void {
|
|
core::print("onlySetter called with ${value}.");
|
|
}
|
|
static method main() → dynamic {
|
|
try {
|
|
core::print(throw new core::NoSuchMethodError::_withType(null, #onlySetter, 33, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}, null));
|
|
throw "No error thrown";
|
|
}
|
|
on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
|
|
core::print("Expected error: ${e}");
|
|
}
|
|
self::onlySetter = "fisk";
|
|
new self::C::•().testC();
|
|
new self::D::•().testD();
|
|
}
|