library test; import self as self; import "dart:core" as core; static method block_test() → void { () →* core::List* g; g = () → core::List* { return [3]; }; assert(g is () →* core::List*); assert(!(g is () →* core::List*)); g.call().{core::List::add}("hello"); core::List* l = [3]; g = () → core::List* { return l; }; assert(g is () →* core::List*); assert(g is () →* core::List*); try { g.call().{core::List::add}("hello"); throw "expected a runtime error"; } on core::TypeError* catch(no-exception-var) { } core::Object* o = l; g = () → core::List* { return o as{TypeError} core::List*; }; assert(g is () →* core::List*); assert(!(g is () →* core::List*)); 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* g; g = () → core::List* => [3]; assert(g is () →* core::List*); assert(!(g is () →* core::List*)); g.call().{core::List::add}("hello"); core::List* l = [3]; g = () → core::List* => l; assert(g is () →* core::List*); assert(g is () →* core::List*); try { g.call().{core::List::add}("hello"); throw "expected a runtime error"; } on core::TypeError* catch(no-exception-var) { } core::Object* o = l; g = () → core::List* => o as{TypeError} core::List*; assert(g is () →* core::List*); assert(!(g is () →* core::List*)); 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(); }