| library; |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| |
| import "dart:async"; |
| |
| static final field core::bool inWeakMode = #C1 is core::List<core::Object>; |
| static method exhaustiveNonNullableTypeVariable<T extends core::Object>(core::int? o) → dynamic |
| return block { |
| core::int #t1; |
| final synthesized core::int? #0#0 = o; |
| #L1: |
| { |
| { |
| if(let final self::exhaustiveNonNullableTypeVariable::T #t2 = #0#0 as self::exhaustiveNonNullableTypeVariable::T in (#0#0 as self::exhaustiveNonNullableTypeVariable::T) is core::int) { |
| #t1 = 0; |
| break #L1; |
| } |
| } |
| } |
| } =>#t1; |
| static method exhaustiveNonNullableType(core::int? o) → dynamic |
| return block { |
| core::int #t3; |
| final synthesized core::int? #0#0 = o; |
| #L2: |
| { |
| { |
| if(let final core::int #t4 = let core::int? #t5 = #0#0 in #t5 == null ?{core::int} #t5 as core::int : #t5{core::int} in true) { |
| #t3 = 0; |
| break #L2; |
| } |
| } |
| } |
| } =>#t3; |
| static method exhaustiveNonNullableSuperType(core::int? o) → dynamic |
| return block { |
| core::int #t6; |
| final synthesized core::int? #0#0 = o; |
| #L3: |
| { |
| { |
| if(let final core::num #t7 = let core::int? #t8 = #0#0 in #t8 == null ?{core::num} #t8 as core::num : #t8{core::num} in (let core::int? #t9 = #0#0 in #t9 == null ?{core::num} #t9 as core::num : #t9{core::num}) is core::int) { |
| #t6 = 0; |
| break #L3; |
| } |
| } |
| } |
| } =>#t6; |
| static method exhaustiveNonNullableFutureOr1(FutureOr<core::int>? o) → dynamic |
| return block { |
| core::int #t10; |
| final synthesized FutureOr<core::int>? #0#0 = o; |
| #L4: |
| { |
| { |
| if(let final FutureOr<core::int>#t11 = let FutureOr<core::int>? #t12 = #0#0 in #t12 == null ?{FutureOr<core::int>} #t12 as FutureOr<core::int> : #t12{FutureOr<core::int>} in true) { |
| #t10 = 0; |
| break #L4; |
| } |
| } |
| } |
| } =>#t10; |
| static method exhaustiveNonNullableFutureOr2(FutureOr<core::int?>o) → dynamic |
| return block { |
| core::int #t13; |
| final synthesized FutureOr<core::int?>#0#0 = o; |
| #L5: |
| { |
| { |
| if(let final FutureOr<core::int>#t14 = #0#0 as FutureOr<core::int> in true) { |
| #t13 = 0; |
| break #L5; |
| } |
| } |
| } |
| } =>#t13; |
| static method exhaustiveNonNullableFutureOrTypeVariable1<T extends core::Object>(FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>? o) → dynamic |
| return block { |
| core::int #t15; |
| final synthesized FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>? #0#0 = o; |
| #L6: |
| { |
| { |
| if(let final FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>#t16 = let FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>? #t17 = #0#0 in #t17 == null ?{FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>} #t17 as FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T> : #t17{FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>} in true) { |
| #t15 = 0; |
| break #L6; |
| } |
| } |
| } |
| } =>#t15; |
| static method exhaustiveNonNullableFutureOrTypeVariable2<T extends core::Object>(FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T?>o) → dynamic |
| return block { |
| core::int #t18; |
| final synthesized FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T?>#0#0 = o; |
| #L7: |
| { |
| { |
| if(let final FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T>#t19 = #0#0 as FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T> in true) { |
| #t18 = 0; |
| break #L7; |
| } |
| } |
| } |
| } =>#t18; |
| static method main() → dynamic { |
| self::expect(0, self::exhaustiveNonNullableTypeVariable<core::Object>(42)); |
| self::expect(0, self::exhaustiveNonNullableTypeVariable<core::int>(42)); |
| self::throws(() → dynamic => self::exhaustiveNonNullableTypeVariable<core::Object>(null)); |
| self::expect(0, self::exhaustiveNonNullableType(42)); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableType(null)); |
| self::expect(0, self::exhaustiveNonNullableSuperType(42)); |
| self::throws(() → dynamic => self::exhaustiveNonNullableSuperType(null)); |
| self::expect(0, self::exhaustiveNonNullableFutureOr1(42)); |
| self::expect(0, self::exhaustiveNonNullableFutureOr1(asy::Future::value<core::int>(42))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOr1(null)); |
| self::expect(0, self::exhaustiveNonNullableFutureOr2(42)); |
| self::expect(0, self::exhaustiveNonNullableFutureOr2(asy::Future::value<core::int>(42))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOr2(asy::Future::value<core::int?>(null))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOr2(null)); |
| self::expect(0, self::exhaustiveNonNullableFutureOrTypeVariable1<core::Object>(42)); |
| self::expect(0, self::exhaustiveNonNullableFutureOrTypeVariable1<core::int>(asy::Future::value<core::int>(42))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOrTypeVariable1<core::Object>(null)); |
| self::expect(0, self::exhaustiveNonNullableFutureOrTypeVariable2<core::int>(42)); |
| self::expect(0, self::exhaustiveNonNullableFutureOrTypeVariable2<core::Object>(asy::Future::value<core::int>(42))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOrTypeVariable2<core::int>(asy::Future::value<core::int?>(null))); |
| self::throwsOr(0, () → dynamic => self::exhaustiveNonNullableFutureOrTypeVariable2<core::Object>(null)); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| throw "Expected ${expected}, actual ${actual}."; |
| } |
| static method throwsOr(dynamic expectedIfWeak, () → dynamic f) → dynamic { |
| if(self::inWeakMode) { |
| self::expect(expectedIfWeak, f(){() → dynamic}); |
| return; |
| } |
| else { |
| self::throws(f); |
| } |
| } |
| static method throws(() → dynamic f) → dynamic { |
| try { |
| f(){() → dynamic}; |
| } |
| on core::Object catch(final core::Object e) { |
| core::print(e); |
| return; |
| } |
| throw "Didn't throw"; |
| } |
| |
| constants { |
| #C1 = <Null>[] |
| } |
| |
| Extra constant evaluation status: |
| Evaluated: IsExpression @ org-dartlang-testcase:///nullable_cast.dart:78:40 -> BoolConstant(false) |
| Extra constant evaluation: evaluated: 163, effectively constant: 1 |