blob: e52bb026a27cfc66ed21aada543631cc114f64e1 [file] [log] [blame]
library test;
import self as self;
import "dart:core" as core;
static method block_test() void {
() core::List<core::Object> g;
g = () dynamic {
return <dynamic>[3];
};
assert(g is () core::List<core::Object>);
assert(!(g is () core::List<core::int>));
g.call().add("hello");
core::List<core::int> l = <dynamic>[3];
g = () dynamic {
return l;
};
assert(g is () core::List<core::Object>);
assert(g is () core::List<core::int>);
try {
g.call().add("hello");
throw "expected a runtime error";
}
on core::TypeError catch(no-exception-var) {
}
core::Object o = l;
g = () dynamic {
return o;
};
assert(g is () core::List<core::Object>);
assert(!(g is () core::List<core::int>));
assert(!(g is () core::Object));
g.call();
o = 3;
try {
g.call();
throw "expected a runtime error";
}
on core::TypeError catch(no-exception-var) {
}
}
static method arrow_test() void {
() core::List<core::Object> g;
g = () dynamic => <dynamic>[3];
assert(g is () core::List<core::Object>);
assert(!(g is () core::List<core::int>));
g.call().add("hello");
core::List<core::int> l = <dynamic>[3];
g = () dynamic => l;
assert(g is () core::List<core::Object>);
assert(g is () core::List<core::int>);
try {
g.call().add("hello");
throw "expected a runtime error";
}
on core::TypeError catch(no-exception-var) {
}
core::Object o = l;
g = () dynamic => o;
assert(g is () core::List<core::Object>);
assert(!(g is () core::List<core::int>));
assert(!(g is () core::Object));
g.call();
o = 3;
try {
g.call();
throw "expected a runtime error";
}
on core::TypeError catch(no-exception-var) {
}
}
static method main() dynamic {
self::block_test();
self::arrow_test();
}