blob: a4a0335d9aa1c01d5a841122338e0ae5ae8e6ec3 [file] [log] [blame]
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 dynamic #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 dynamic #t4 = #0#0 as core::int in true) {
#t3 = 0;
break #L2;
}
}
}
} =>#t3;
static method exhaustiveNonNullableSuperType(core::int? o) dynamic
return block {
core::int #t5;
final synthesized core::int? #0#0 = o;
#L3:
{
{
if(let final dynamic #t6 = #0#0 as core::num in (#0#0 as core::num) is core::int) {
#t5 = 0;
break #L3;
}
}
}
} =>#t5;
static method exhaustiveNonNullableFutureOr1(FutureOr<core::int>? o) dynamic
return block {
core::int #t7;
final synthesized FutureOr<core::int>? #0#0 = o;
#L4:
{
{
if(let final dynamic #t8 = #0#0 as FutureOr<core::int> in true) {
#t7 = 0;
break #L4;
}
}
}
} =>#t7;
static method exhaustiveNonNullableFutureOr2(FutureOr<core::int?>o) dynamic
return block {
core::int #t9;
final synthesized FutureOr<core::int?>#0#0 = o;
#L5:
{
{
if(let final dynamic #t10 = #0#0 as FutureOr<core::int> in true) {
#t9 = 0;
break #L5;
}
}
}
} =>#t9;
static method exhaustiveNonNullableFutureOrTypeVariable1<T extends core::Object>(FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>? o) dynamic
return block {
core::int #t11;
final synthesized FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T>? #0#0 = o;
#L6:
{
{
if(let final dynamic #t12 = #0#0 as FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable1::T> in true) {
#t11 = 0;
break #L6;
}
}
}
} =>#t11;
static method exhaustiveNonNullableFutureOrTypeVariable2<T extends core::Object>(FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T?>o) dynamic
return block {
core::int #t13;
final synthesized FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T?>#0#0 = o;
#L7:
{
{
if(let final dynamic #t14 = #0#0 as FutureOr<self::exhaustiveNonNullableFutureOrTypeVariable2::T> in true) {
#t13 = 0;
break #L7;
}
}
}
} =>#t13;
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>[]
}