|
| 1 | +library /*isNonNullableByDefault*/; |
| 2 | +import self as self; |
| 3 | +import "dart:core" as core; |
| 4 | +import "type_parameter_nullability_lib.dart" as typ; |
| 5 | + |
| 6 | +import "org-dartlang-testcase:///type_parameter_nullability_lib.dart"; |
| 7 | + |
| 8 | +class C<T extends core::num? = core::num?, S extends core::Object? = dynamic, U extends core::Object? = dynamic> extends core::Object { |
| 9 | + synthetic constructor •() → self::C<self::C::T%, self::C::S%, self::C::U%> |
| 10 | + : super core::Object::•() |
| 11 | + ; |
| 12 | + method promoteNullable(generic-covariant-impl self::C::T? t) → void { |
| 13 | + if(t is{ForNonNullableByDefault} core::int) { |
| 14 | + t{self::C::T? & core::int /* '?' & '!' = '!' */}; |
| 15 | + } |
| 16 | + if(t is{ForNonNullableByDefault} core::int?) { |
| 17 | + t{self::C::T? & core::int? /* '?' & '?' = '?' */}; |
| 18 | + } |
| 19 | + } |
| 20 | + method nullableAsUndetermined(generic-covariant-impl self::C::S? s) → void { |
| 21 | + s as{ForNonNullableByDefault} self::C::U%; |
| 22 | + } |
| 23 | +} |
| 24 | +static method main() → dynamic { |
| 25 | + self::C<core::num, core::num, core::num> c = new self::C::•<core::num, core::num, core::num>(); |
| 26 | + c.{self::C::promoteNullable}(null); |
| 27 | + c.{self::C::promoteNullable}(0); |
| 28 | + c.{self::C::nullableAsUndetermined}(null); |
| 29 | + c.{self::C::nullableAsUndetermined}(0); |
| 30 | + typ::D<core::num> d = new typ::D::•<core::num>(); |
| 31 | + d.{typ::D::promoteLegacy}(null); |
| 32 | + d.{typ::D::promoteLegacy}(0); |
| 33 | +} |
| 34 | + |
| 35 | +library; |
| 36 | +import self as typ; |
| 37 | +import "dart:core" as core; |
| 38 | + |
| 39 | +class D<T extends core::num* = core::num*> extends core::Object { |
| 40 | + synthetic constructor •() → typ::D<typ::D::T*>* |
| 41 | + : super core::Object::•() |
| 42 | + ; |
| 43 | + method promoteLegacy(generic-covariant-impl typ::D::T* t) → void { |
| 44 | + if(t is core::int*) { |
| 45 | + let final typ::D::T* & core::int* /* '*' & '*' = '*' */ #t1 = t{typ::D::T* & core::int* /* '*' & '*' = '*' */} in #t1.{core::num::==}(null) ?{core::bool*} null : #t1.{core::int::isEven}; |
| 46 | + } |
| 47 | + } |
| 48 | + abstract member-signature get _identityHashCode() → core::int*; |
| 49 | + abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; |
| 50 | + abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; |
| 51 | + abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; |
| 52 | + abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; |
| 53 | + abstract member-signature operator ==(dynamic other) → core::bool*; |
| 54 | + abstract member-signature get hashCode() → core::int*; |
| 55 | + abstract member-signature method toString() → core::String*; |
| 56 | + abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; |
| 57 | + abstract member-signature get runtimeType() → core::Type*; |
| 58 | +} |
0 commit comments