| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| |
| typedef Callback<contravariant T extends core::Object? = dynamic> = (T%) → void; |
| class Foo<T extends core::Object? = dynamic> extends core::Object { |
| final field self::Foo::T% finalField; |
| final field (self::Foo::T%) → void callbackField; |
| late covariant-by-class field self::Foo::T% mutableField; |
| late field (self::Foo::T%) → void mutableCallbackField; |
| constructor •(self::Foo::T% finalField, (self::Foo::T%) → void callbackField) → self::Foo<self::Foo::T%> |
| : self::Foo::finalField = finalField, self::Foo::callbackField = callbackField, super core::Object::•() |
| ; |
| method method(covariant-by-class self::Foo::T% x) → void {} |
| set setter(covariant-by-class self::Foo::T% x) → void {} |
| method withCallback((self::Foo::T%) → void callback) → void { |
| callback(this.{self::Foo::finalField}{self::Foo::T%}){(self::Foo::T%) → void}; |
| } |
| } |
| static method main() → dynamic { |
| self::Foo<core::int> fooInt = new self::Foo::•<core::int>(1, (core::int x) → void {}); |
| fooInt.{self::Foo::method}(3){(core::int) → void}; |
| fooInt.{self::Foo::setter} = 3; |
| fooInt.{self::Foo::withCallback}((core::int x) → void {}){((core::int) → void) → void}; |
| fooInt.{self::Foo::withCallback}((core::num x) → void {}){((core::int) → void) → void}; |
| fooInt.{self::Foo::mutableField} = 3; |
| fooInt.{self::Foo::mutableCallbackField} = (core::int x) → void {}; |
| self::Foo<core::num> fooNum = fooInt; |
| fooNum.{self::Foo::method}(3){(core::num) → void}; |
| fooNum.{self::Foo::method}(2.5){(core::num) → void}; |
| fooNum.{self::Foo::setter} = 3; |
| fooNum.{self::Foo::setter} = 2.5; |
| fooNum.{self::Foo::withCallback}((core::num x) → void {}){((core::num) → void) → void}; |
| fooNum.{self::Foo::mutableField} = 3; |
| fooNum.{self::Foo::mutableField} = 2.5; |
| let final self::Foo<core::num> #t1 = fooNum in let final core::int #t2 = 3 in (#t1.{self::Foo::mutableCallbackField}{(core::num) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::num) → void)(#t2){(core::num) → void}; |
| let final self::Foo<core::num> #t3 = fooNum in let final core::double #t4 = 2.5 in (#t3.{self::Foo::mutableCallbackField}{(core::num) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::num) → void)(#t4){(core::num) → void}; |
| fooNum.{self::Foo::mutableCallbackField} = (core::num x) → void {}; |
| } |
| |
| |
| Extra constant evaluation status: |
| Evaluated: VariableGet @ org-dartlang-testcase:///covariant_generic2.dart:43:31 -> IntConstant(3) |
| Evaluated: VariableGet @ org-dartlang-testcase:///covariant_generic2.dart:44:31 -> DoubleConstant(2.5) |
| Extra constant evaluation: evaluated: 58, effectively constant: 2 |