| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| abstract class A<X extends core::Object? = dynamic> extends core::Object { |
| synthetic constructor •() → self::A<self::A::X%> |
| : super core::Object::•() |
| ; |
| abstract get g() → (self::A::X%) → void; |
| } |
| class B extends core::Object implements self::A<core::int> { |
| synthetic constructor •() → self::B |
| : super core::Object::•() |
| ; |
| get g() → (core::int) → void |
| return (core::int i) → void => let final core::int #t1 = self::callCount in let final core::int #t2 = self::callCount = #t1.{core::num::+}(1){(core::num) → core::int} in #t1; |
| } |
| static field core::int callCount = 0; |
| static method foo(core::Object o, core::num value) → void { |
| #L1: |
| { |
| final synthesized core::Object #0#0 = o; |
| synthesized dynamic #0#2; |
| synthesized core::bool #0#2#isSet = false; |
| { |
| hoisted (core::num) → void f; |
| if(#0#0 is self::B && (let final (core::int) → void #t3 = #0#2#isSet ?{(core::int) → void} #0#2{(core::int) → void} : let final core::bool #t4 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::B::g}{(core::int) → void} in true) && (let final (core::num) → void #t5 = f = (#0#2#isSet ?{(core::num) → void} #0#2{(core::num) → void} : let final core::bool #t6 = #0#2#isSet = true in #0#2 = #0#0{self::B}.{self::A::g}{(core::num) → void}) as{CovarianceCheck} (core::num) → void in true)) { |
| { |
| f(value){(core::num) → void}; |
| } |
| } |
| } |
| } |
| } |
| static method main() → void { |
| self::expect(0, self::callCount); |
| self::throws(() → void => self::foo(new self::B::•(), 25.7)); |
| self::expect(0, self::callCount); |
| self::throws(() → void => self::foo(new self::B::•(), 1)); |
| self::expect(0, self::callCount); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) { |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| } |
| static method throws(() → void f) → dynamic { |
| try { |
| f(){() → void}; |
| } |
| on core::Object catch(final core::Object e) { |
| core::print(e); |
| return; |
| } |
| throw "No exception thrown"; |
| } |