blob: 6b419a6216e1cde1b1953c3f3e5dbd84a8f0d559 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method test1(dynamic x) dynamic {
return block {
core::String #t1;
final synthesized dynamic #0#0 = x;
#L1:
{
{
if(#C1 =={core::num::==}{(core::Object) core::bool} #0#0) {
#t1 = "zero";
break #L1;
}
}
{
if(true) {
#t1 = "other";
break #L1;
}
}
}
} =>#t1;
}
static method test2(core::String x) dynamic {
return block {
core::int #t2;
final synthesized core::String #0#0 = x;
#L2:
{
{
if(#C2 =={core::String::==}{(core::Object) core::bool} #0#0) {
#t2 = 0;
break #L2;
}
}
{
if(true) {
#t2 = 1;
break #L2;
}
}
}
} =>#t2;
}
static method main() dynamic {
self::expectEquals(self::test1(0), "zero");
self::expectEquals(self::test1(null), "other");
self::expectEquals(self::test1(<dynamic>[]), "other");
self::expectEquals(self::test2("zero"), 0);
self::expectEquals(self::test2("one"), 1);
self::expectEquals(self::test2("two"), 1);
}
static method expectEquals(dynamic x, dynamic y) dynamic {
if(!(x =={core::Object::==}{(core::Object) core::bool} y)) {
throw "Expected ${x} to be equal to ${y}.";
}
}
constants {
#C1 = 0
#C2 = "zero"
}