| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| |
| class Class extends core::Object { |
| field core::int field1 = 42; |
| field core::int field2 = 87; |
| synthetic constructor •() → self::Class |
| : super core::Object::•() |
| ; |
| } |
| extension Extension1 on self::Class { |
| get field = self::Extension1|get#field; |
| method method = self::Extension1|method; |
| tearoff method = self::Extension1|get#method; |
| method genericMethod = self::Extension1|genericMethod; |
| tearoff genericMethod = self::Extension1|get#genericMethod; |
| set field = self::Extension1|set#field; |
| } |
| extension Extension2 on self::Class { |
| get field = self::Extension2|get#field; |
| method method = self::Extension2|method; |
| tearoff method = self::Extension2|get#method; |
| method genericMethod = self::Extension2|genericMethod; |
| tearoff genericMethod = self::Extension2|get#genericMethod; |
| set field = self::Extension2|set#field; |
| } |
| static method Extension1|get#field(lowered final self::Class #this) → core::int |
| return #this.{self::Class::field1}{core::int}; |
| static method Extension1|set#field(lowered final self::Class #this, core::int value) → void { |
| #this.{self::Class::field1} = value; |
| } |
| static method Extension1|method(lowered final self::Class #this) → core::int |
| return #this.{self::Class::field1}{core::int}; |
| static method Extension1|get#method(lowered final self::Class #this) → () → core::int |
| return () → core::int => self::Extension1|method(#this); |
| static method Extension1|genericMethod<T extends core::num>(lowered final self::Class #this, self::Extension1|genericMethod::T t) → core::num |
| return #this.{self::Class::field1}{core::int}.{core::num::+}(t){(core::num) → core::num}; |
| static method Extension1|get#genericMethod(lowered final self::Class #this) → <T extends core::num>(T) → core::num |
| return <T extends core::num>(T t) → core::num => self::Extension1|genericMethod<T>(#this, t); |
| static method Extension2|get#field(lowered final self::Class #this) → core::int |
| return #this.{self::Class::field2}{core::int}; |
| static method Extension2|set#field(lowered final self::Class #this, core::int value) → void { |
| #this.{self::Class::field2} = value; |
| } |
| static method Extension2|method(lowered final self::Class #this) → core::int |
| return #this.{self::Class::field2}{core::int}; |
| static method Extension2|get#method(lowered final self::Class #this) → () → core::int |
| return () → core::int => self::Extension2|method(#this); |
| static method Extension2|genericMethod<T extends core::num>(lowered final self::Class #this, self::Extension2|genericMethod::T t) → core::num |
| return #this.{self::Class::field2}{core::int}.{core::num::+}(t){(core::num) → core::num}; |
| static method Extension2|get#genericMethod(lowered final self::Class #this) → <T extends core::num>(T) → core::num |
| return <T extends core::num>(T t) → core::num => self::Extension2|genericMethod<T>(#this, t); |
| static method main() → dynamic { |
| self::Class c = new self::Class::•(); |
| self::expect(42, self::Extension1|get#field(c)); |
| self::expect(87, self::Extension2|get#field(c)); |
| self::expect(42, self::Extension1|method(c)); |
| self::expect(87, self::Extension2|method(c)); |
| () → core::int tearOff1 = self::Extension1|get#method(c); |
| () → core::int tearOff2 = self::Extension2|get#method(c); |
| self::expect(42, tearOff1(){() → core::int}); |
| self::expect(87, tearOff2(){() → core::int}); |
| self::expect(52, self::Extension1|genericMethod<core::int>(c, 10)); |
| self::expect(97, self::Extension2|genericMethod<core::int>(c, 10)); |
| self::expect(52, self::Extension1|genericMethod<core::num>(c, 10)); |
| self::expect(97, self::Extension2|genericMethod<core::num>(c, 10)); |
| <T extends core::num>(T) → core::num genericTearOff1 = self::Extension1|get#genericMethod(c); |
| <T extends core::num>(T) → core::num genericTearOff2 = self::Extension2|get#genericMethod(c); |
| self::expect(52, genericTearOff1<core::int>(10){(core::int) → core::num}); |
| self::expect(97, genericTearOff2<core::int>(10){(core::int) → core::num}); |
| self::expect(52, genericTearOff1<core::num>(10){(core::num) → core::num}); |
| self::expect(97, genericTearOff2<core::num>(10){(core::num) → core::num}); |
| self::expect(23, let final self::Class #t1 = c in let final core::int #t2 = 23 in let final void #t3 = self::Extension1|set#field(#t1, #t2) in #t2); |
| self::expect(67, let final self::Class #t4 = c in let final core::int #t5 = 67 in let final void #t6 = self::Extension2|set#field(#t4, #t5) in #t5); |
| self::expect(23, self::Extension1|get#field(c)); |
| self::expect(67, self::Extension2|get#field(c)); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) { |
| throw "Mismatch: expected=${expected}, actual=${actual}"; |
| } |
| } |
| |
| |
| Extra constant evaluation status: |
| Evaluated: VariableGet @ org-dartlang-testcase:///explicit_extension_access.dart:48:36 -> IntConstant(23) |
| Evaluated: VariableGet @ org-dartlang-testcase:///explicit_extension_access.dart:48:36 -> IntConstant(23) |
| Evaluated: VariableGet @ org-dartlang-testcase:///explicit_extension_access.dart:49:36 -> IntConstant(67) |
| Evaluated: VariableGet @ org-dartlang-testcase:///explicit_extension_access.dart:49:36 -> IntConstant(67) |
| Extra constant evaluation: evaluated: 119, effectively constant: 4 |