blob: 2a5aff4060134bbfb79ca4fbdd1512fd1abd5ee7 [file] [log] [blame]
library;
//
// Problems in library:
//
// pkg/front_end/testcases/patterns/issue51604.dart:9:14: Error: The variable 'i' is available in some, but not all cases that share this body.
// return i; // Error.
// ^
//
// pkg/front_end/testcases/patterns/issue51604.dart:12:14: Error: The variable 's' is available in some, but not all cases that share this body.
// return s; // Error.
// ^
//
// pkg/front_end/testcases/patterns/issue51604.dart:15:14: Error: The variable 'd' is available in some, but not all cases that share this body.
// return d; // Error.
// ^
//
// pkg/front_end/testcases/patterns/issue51604.dart:18:14: Error: The variable 'b' is available in some, but not all cases that share this body.
// return b; // Error.
// ^
//
// pkg/front_end/testcases/patterns/issue51604.dart:30:14: Error: The variable 'i2' is not available because there is a label or 'default' case.
// return i2; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:33:14: Error: The variable 's2' is not available because there is a label or 'default' case.
// return s2; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:30:14: Error: Non-nullable variable 'i2' must be assigned before it can be used.
// return i2; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:33:14: Error: Non-nullable variable 's2' must be assigned before it can be used.
// return s2; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:44:14: Error: The variable 'i3' is not available because there is a label or 'default' case.
// return i3; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:48:14: Error: The variable 's3' is not available because there is a label or 'default' case.
// return s3; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:59:14: Error: The variable 'i4' is not available because there is a label or 'default' case.
// return i4; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:63:14: Error: Variable pattern 's4' doesn't have the same type or finality in all cases.
// return s4; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:63:14: Error: The variable 's4' is not available because there is a label or 'default' case.
// return s4; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:59:14: Error: Variable pattern 'i4' doesn't have the same type or finality in all cases.
// return i4; // Error.
// ^
//
// pkg/front_end/testcases/patterns/issue51604.dart:87:16: Error: The variable 'i6' is not available because there is a label or 'default' case.
// return i6; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:93:18: Error: The variable 's6' is not available because there is a label or 'default' case.
// return s6; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:87:16: Error: Non-nullable variable 'i6' must be assigned before it can be used.
// return i6; // Error.
// ^^
//
// pkg/front_end/testcases/patterns/issue51604.dart:93:18: Error: Non-nullable variable 's6' must be assigned before it can be used.
// return s6; // Error.
// ^^
//
import self as self;
import "dart:core" as core;
static method test1(dynamic x) dynamic {
#L1:
{
final synthesized dynamic #0#0 = x;
dynamic #t1;
dynamic #t2;
dynamic #t3;
dynamic #t4;
{
hoisted core::int i;
if(#C1 =={core::num::==}{(core::Object) core::bool} #0#0 || #0#0 is core::int && (let final core::int #t5 = i = #0#0{core::int} in true) && (let final core::int #t6 = #t1 = i in true)) {
invalid-type i = #t1{invalid-type};
{
return i;
}
}
}
{
hoisted core::String s;
if(#0#0 is core::String && (let final core::String #t7 = s = #0#0{core::String} in true) && (let final core::String #t8 = #t2 = s in true) || #C2 =={core::String::==}{(core::Object) → core::bool} #0#0) {
core::String s = #t2{core::String};
{
return s;
}
}
}
{
hoisted core::double d;
if(#0#0 is core::double && (let final core::double #t9 = d = #0#0{core::double} in true) && (let final core::double #t10 = #t3 = d in true) || #0#0{dynamic}.<(#C3) as core::bool) {
core::double d = #t3{core::double};
{
return d;
}
}
}
{
hoisted core::bool b;
if(#0#0 =={core::Object::==}{(core::Object) → core::bool} #C4 || #0#0 is core::bool && (let final core::bool #t11 = b = #0#0{core::bool} in true) && (let final core::bool #t12 = #t4 = b in true)) {
invalid-type b = #t4{invalid-type};
{
return b;
}
}
}
{
{
{
return null;
}
}
}
}
}
static method test2(dynamic x) dynamic {
#L2:
{
core::int #t13 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i2;
final synthesized dynamic #0#0 = x;
#L3:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t13 = 0;
break #L3;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t14 = i2 = #0#0{core::int} in true)) {
#t13 = 0;
break #L3;
}
}
{
hoisted core::String s2;
if(#0#0 is core::String && (let final core::String #t15 = s2 = #0#0{core::String} in true) || true) {
{
return invalid-expression "pkg/front_end/testcases/patterns/issue51604.dart:33:14: Error: Non-nullable variable 's2' must be assigned before it can be used.
return s2; // Error.
^^" in s2;
}
}
}
}
switch(#t13) /* dynamic */ {
#L4:
case #C1:
{
{
return invalid-expression "pkg/front_end/testcases/patterns/issue51604.dart:30:14: Error: Non-nullable variable 'i2' must be assigned before it can be used.
return i2; // Error.
^^" in i2;
}
}
}
}
}
static method test3(dynamic x) dynamic {
#L5:
{
core::int #t16 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i3;
hoisted core::int i3#1;
final synthesized dynamic #0#0 = x;
synthesized core::bool #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized dynamic #0#8;
synthesized core::bool #0#8#isSet = false;
dynamic #t17;
dynamic #t18;
#L6:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t16 = 0;
break #L6;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t19 = i3 = #0#0{core::int} in true) && (let final core::int #t20 = #t17 = i3 in true) || #0#0 is core::List<dynamic> && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t21 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5) && ((#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t22 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final core::int #t23 = i3#1 = (#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t24 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) && (let final core::int #t25 = #t17 = i3#1 in true)) {
#t16 = 0;
break #L6;
}
}
{
lowered hoisted core::String s3#case#0;
lowered hoisted core::String s3#case#1;
if(#0#0 is core::String && (let final core::String #t26 = s3#case#0 = #0#0{core::String} in true) && (let final core::String #t27 = #t18 = s3#case#0 in true) || #0#0 is core::List<dynamic> && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t28 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5) && ((#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t29 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::String && (let final core::String #t30 = s3#case#1 = (#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t31 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::String in true)) && (let final core::String #t32 = #t18 = s3#case#1 in true) || true) {
core::String s3 = #t18{core::String};
{
return s3;
}
}
}
}
switch(#t16) /* dynamic */ {
#L7:
case #C1:
{
core::int i3 = #t17{core::int};
{
return i3;
}
}
}
}
}
static method test4(dynamic x) dynamic {
#L8:
{
core::int #t33 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i4;
hoisted core::double i4#1;
final synthesized dynamic #0#0 = x;
synthesized core::bool #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized dynamic #0#8;
synthesized core::bool #0#8#isSet = false;
dynamic #t34;
dynamic #t35;
#L9:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t33 = 0;
break #L9;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t36 = i4 = #0#0{core::int} in true) && (let final core::int #t37 = #t34 = i4 in true) || #0#0 is core::List<dynamic> && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t38 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5) && ((#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t39 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::double && (let final core::double #t40 = i4#1 = (#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t41 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::double in true)) && (let final core::double #t42 = #t34 = i4#1 in true)) {
#t33 = 0;
break #L9;
}
}
{
lowered hoisted core::String s4#case#0;
lowered final hoisted core::String s4#case#1;
if(#0#0 is core::String && (let final core::String #t43 = s4#case#0 = #0#0{core::String} in true) && (let final core::String #t44 = #t35 = s4#case#0 in true) || #0#0 is core::List<dynamic> && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t45 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5) && ((#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t46 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::String && (let final core::String #t47 = s4#case#1 = (#0#8#isSet ?{dynamic} #0#8{dynamic} : let final core::bool #t48 = #0#8#isSet = true in #0#8 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::String in true)) && (let final core::String #t49 = #t35 = s4#case#1 in true) || true) {
core::String s4 = #t35{core::String};
{
return s4;
}
}
}
}
switch(#t33) /* dynamic */ {
#L10:
case #C1:
{
core::int i4 = invalid-expression "pkg/front_end/testcases/patterns/issue51604.dart:59:14: Error: Variable pattern 'i4' doesn't have the same type or finality in all cases.
return i4; // Error.
^";
{
return i4;
}
}
}
}
}
static method test5(dynamic x) dynamic {
#L11:
{
core::int #t50 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i5;
final synthesized dynamic #0#0 = x;
#L12:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t50 = 0;
break #L12;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t51 = i5 = #0#0{core::int} in true) && i5 =={core::num::==}{(core::Object) → core::bool} 1) {
#t50 = 0;
break #L12;
}
}
{
hoisted core::String s5;
if(#0#0 is core::String && (let final core::String #t52 = s5 = #0#0{core::String} in true) && s5 =={core::String::==}{(core::Object) → core::bool} "foo" || true) {
{
return null;
}
}
}
}
switch(#t50) /* dynamic */ {
#L13:
case #C1:
{
{
return null;
}
}
}
}
}
static method test6(dynamic x, core::bool b) dynamic {
#L14:
{
core::int #t53 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i6;
final synthesized dynamic #0#0 = x;
#L15:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t53 = 0;
break #L15;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t54 = i6 = #0#0{core::int} in true)) {
#t53 = 0;
break #L15;
}
}
{
hoisted core::String s6;
if(#0#0 is core::String && (let final core::String #t55 = s6 = #0#0{core::String} in true) || true) {
{
if(b) {
if(b) {
return invalid-expression "pkg/front_end/testcases/patterns/issue51604.dart:93:18: Error: Non-nullable variable 's6' must be assigned before it can be used.
return s6; // Error.
^^" in s6;
}
}
}
}
}
}
switch(#t53) /* dynamic */ {
#L16:
case #C1:
{
{
if(b) {
return invalid-expression "pkg/front_end/testcases/patterns/issue51604.dart:87:16: Error: Non-nullable variable 'i6' must be assigned before it can be used.
return i6; // Error.
^^" in i6;
}
break #L14;
}
}
}
}
}
static method test7(dynamic x) dynamic {
#L17:
{
core::int #t56 = 1.{core::int::unary-}(){() → core::int};
hoisted core::int i7;
final synthesized dynamic #0#0 = x;
#L18:
{
{
if(#0#0{dynamic}.<=(#C1) as core::bool) {
{
#t56 = 0;
break #L18;
}
}
}
{
if(#0#0 is core::int && (let final core::int #t57 = i7 = #0#0{core::int} in true) && i7 =={core::num::==}{(core::Object) → core::bool} 1) {
#t56 = 0;
break #L18;
}
}
{
hoisted core::String s7;
if(#0#0 is core::String && (let final core::String #t58 = s7 = #0#0{core::String} in true) && s7 =={core::String::==}{(core::Object) → core::bool} "foo" || true) {
{
core::String s7 = "foo";
return s7;
}
}
}
}
switch(#t56) /* dynamic */ {
#L19:
case #C1:
{
{
core::int i7 = 1;
return i7;
}
}
}
}
}
constants {
#C1 = 0
#C2 = "foo"
#C3 = 3.14
#C4 = false
#C5 = 1
}
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:25:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:38:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:53:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:68:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:81:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue51604.dart:100:3 -> IntConstant(-1)
Extra constant evaluation: evaluated: 384, effectively constant: 6