| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| static method main() → dynamic { |
| self::throws(() → void { |
| if(self::val(10) =={core::num::==}{(core::Object) → core::bool} 10 && self::guard(42) as{TypeError,ForDynamic} core::bool) { |
| core::print("cast on conditions catches non-bools"); |
| } |
| }); |
| self::throws(() → void { |
| (core::int) r = (10); |
| { |
| final synthesized(core::int) #0#0 = r; |
| if(#C1 =={core::num::==}{(core::Object) → core::bool} #0#0.$1{core::int} && self::guard(42) as{TypeError} core::bool) { |
| core::print("missing cast on conditions allows this code to execute"); |
| } |
| } |
| }); |
| } |
| static method val(core::int x) → core::int |
| return x; |
| static method guard(dynamic x) → dynamic |
| return x; |
| static method throws(() → void f) → dynamic { |
| try { |
| f(){() → void}; |
| } |
| on core::Object catch(final core::Object e) { |
| core::print(e); |
| return; |
| } |
| throw "Missing exception"; |
| } |
| |
| constants { |
| #C1 = 10 |
| } |