| 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 dynamic #t5 = i = #0#0{core::int} in true) && (let final dynamic #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 dynamic #t7 = s = #0#0{core::String} in true) && (let final dynamic #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 dynamic #t9 = d = #0#0{core::double} in true) && (let final dynamic #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 dynamic #t11 = b = #0#0{core::bool} in true) && (let final dynamic #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 dynamic #t14 = i2 = #0#0{core::int} in true)) { |
| #t13 = 0; |
| break #L3; |
| } |
| } |
| { |
| hoisted core::String s2; |
| if(#0#0 is core::String && (let final dynamic #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; |
| late final synthesized core::bool #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5; |
| late final synthesized dynamic #0#8 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic}; |
| 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 dynamic #t19 = i3 = #0#0{core::int} in true) && (let final dynamic #t20 = #t17 = i3 in true) || #0#0 is core::List<dynamic> && #0#6 && (#0#8 is core::int && (let final dynamic #t21 = i3#1 = #0#8{core::int} in true)) && (let final dynamic #t22 = #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 dynamic #t23 = s3#case#0 = #0#0{core::String} in true) && (let final dynamic #t24 = #t18 = s3#case#0 in true) || #0#0 is core::List<dynamic> && #0#6 && (#0#8 is core::String && (let final dynamic #t25 = s3#case#1 = #0#8{core::String} in true)) && (let final dynamic #t26 = #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 #t27 = 1.{core::int::unary-}(){() → core::int}; |
| hoisted core::int i4; |
| hoisted core::double i4#1; |
| final synthesized dynamic #0#0 = x; |
| late final synthesized core::bool #0#6 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C5; |
| late final synthesized dynamic #0#8 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic}; |
| dynamic #t28; |
| dynamic #t29; |
| #L9: |
| { |
| { |
| if(#0#0{dynamic}.<=(#C1) as core::bool) { |
| { |
| #t27 = 0; |
| break #L9; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::int && (let final dynamic #t30 = i4 = #0#0{core::int} in true) && (let final dynamic #t31 = #t28 = i4 in true) || #0#0 is core::List<dynamic> && #0#6 && (#0#8 is core::double && (let final dynamic #t32 = i4#1 = #0#8{core::double} in true)) && (let final dynamic #t33 = #t28 = i4#1 in true)) { |
| #t27 = 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 dynamic #t34 = s4#case#0 = #0#0{core::String} in true) && (let final dynamic #t35 = #t29 = s4#case#0 in true) || #0#0 is core::List<dynamic> && #0#6 && (#0#8 is core::String && (let final dynamic #t36 = s4#case#1 = #0#8{core::String} in true)) && (let final dynamic #t37 = #t29 = s4#case#1 in true) || true) { |
| core::String s4 = #t29{core::String}; |
| { |
| return s4; |
| } |
| } |
| } |
| } |
| switch(#t27) /* 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 #t38 = 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) { |
| { |
| #t38 = 0; |
| break #L12; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::int && (let final dynamic #t39 = i5 = #0#0{core::int} in true) && i5 =={core::num::==}{(core::Object) → core::bool} 1) { |
| #t38 = 0; |
| break #L12; |
| } |
| } |
| { |
| hoisted core::String s5; |
| if(#0#0 is core::String && (let final dynamic #t40 = s5 = #0#0{core::String} in true) && s5 =={core::String::==}{(core::Object) → core::bool} "foo" || true) { |
| { |
| return null; |
| } |
| } |
| } |
| } |
| switch(#t38) /* dynamic */ { |
| #L13: |
| case #C1: |
| { |
| { |
| return null; |
| } |
| } |
| } |
| } |
| } |
| static method test6(dynamic x, core::bool b) → dynamic { |
| #L14: |
| { |
| core::int #t41 = 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) { |
| { |
| #t41 = 0; |
| break #L15; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::int && (let final dynamic #t42 = i6 = #0#0{core::int} in true)) { |
| #t41 = 0; |
| break #L15; |
| } |
| } |
| { |
| hoisted core::String s6; |
| if(#0#0 is core::String && (let final dynamic #t43 = 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(#t41) /* 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 #t44 = 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) { |
| { |
| #t44 = 0; |
| break #L18; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::int && (let final dynamic #t45 = i7 = #0#0{core::int} in true) && i7 =={core::num::==}{(core::Object) → core::bool} 1) { |
| #t44 = 0; |
| break #L18; |
| } |
| } |
| { |
| hoisted core::String s7; |
| if(#0#0 is core::String && (let final dynamic #t46 = s7 = #0#0{core::String} in true) && s7 =={core::String::==}{(core::Object) → core::bool} "foo" || true) { |
| { |
| core::String s7 = "foo"; |
| return s7; |
| } |
| } |
| } |
| } |
| switch(#t44) /* dynamic */ { |
| #L19: |
| case #C1: |
| { |
| { |
| core::int i7 = 1; |
| return i7; |
| } |
| } |
| } |
| } |
| } |
| |
| constants { |
| #C1 = 0 |
| #C2 = "foo" |
| #C3 = 3.14 |
| #C4 = false |
| #C5 = 1 |
| } |