| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:36:10: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case [42]: |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:39:15: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case <num>[42]: |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:50:10: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case {42: 'foo'}: |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:53:23: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case <num, Object>{42: 'foo'}: |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:56:15: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case Const(42): |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:56:10: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case Const(42): |
| // ^^^^^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:59:20: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case Const<num>(42): |
| // ^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:59:10: Error: The 'patterns' language feature is disabled for this library. |
| // Try removing the `@dart=` annotation or setting the language version to 3.0 or higher. |
| // case Const<num>(42): |
| // ^^^^^ |
| // pkg/front_end/testcases/general/implicit_constant_in_switch.dart:5:1: Context: This is the annotation that opts out this library from the 'patterns' language feature. |
| // // @dart=2.18 |
| // ^^^^^^^^^^^^^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class Const<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ { |
| final field self::Const::T% value; |
| const constructor •(self::Const::T% value) → self::Const<self::Const::T%> |
| : self::Const::value = value, super core::Object::•() |
| ; |
| } |
| static method main() → dynamic { |
| self::test(42, false); |
| self::test(core::_GrowableList::_literal1<core::int>(42), false); |
| self::test(core::_GrowableList::_literal1<core::num>(42), false); |
| self::test(<core::int, core::String>{42: "foo"}, false); |
| self::test(<core::num, core::Object>{42: "foo"}, false); |
| self::test(new self::Const::•<core::int>(42), false); |
| self::test(new self::Const::•<core::num>(42), false); |
| self::test(#C2, true); |
| self::test(#C3, true); |
| self::test(#C5, true); |
| self::test(#C6, true); |
| self::test(#C7, true); |
| self::test(#C8, true); |
| } |
| static method test(dynamic value, core::bool expected) → void { |
| core::bool matched; |
| #L1: |
| { |
| final dynamic #t1 = value; |
| final core::int #t2 = -1; |
| final core::bool #t3 = false; |
| if(!#t3) { |
| final dynamic #t4 = #t1; |
| if(#t4 is core::List<dynamic> && #t4{core::List<dynamic>}.{core::List::length}{core::int}.{core::num::==}(1){(core::Object) → core::bool}) { |
| final dynamic #t5 = #t4{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}; |
| if(#t5 =={core::Object::==}{(core::Object) → core::bool} 42) { |
| #t2 = 0; |
| #t3 = true; |
| } |
| } |
| } |
| if(!#t3) { |
| final dynamic #t6 = #t1; |
| if(#t6 is core::List<core::num> && #t6{core::List<core::num>}.{core::List::length}{core::int}.{core::num::==}(1){(core::Object) → core::bool}) { |
| final core::num #t7 = #t6{core::List<core::num>}.{core::List::[]}(0){(core::int) → core::num}; |
| if(#t7 =={core::num::==}{(core::Object) → core::bool} 42) { |
| #t2 = 1; |
| #t3 = true; |
| } |
| } |
| } |
| if(!#t3) { |
| final dynamic #t8 = #t1; |
| if(#t8 is{ForNonNullableByDefault} core::Map<dynamic, dynamic> && #t8{core::Map<dynamic, dynamic>}.{core::Map::containsKey}(42){(core::Object?) → core::bool}) { |
| final dynamic #t9 = #t8{core::Map<dynamic, dynamic>}.{core::Map::[]}(42){(core::Object?) → dynamic}; |
| if(#t9 =={core::Object::==}{(core::Object) → core::bool} "foo") { |
| #t2 = 2; |
| #t3 = true; |
| } |
| } |
| } |
| if(!#t3) { |
| final dynamic #t10 = #t1; |
| if(#t10 is{ForNonNullableByDefault} core::Map<core::num, core::Object> && #t10{core::Map<core::num, core::Object>}.{core::Map::containsKey}(42){(core::Object?) → core::bool}) { |
| final core::Object #t11 = #t10{core::Map<core::num, core::Object>}.{core::Map::[]}(42){(core::Object?) → core::Object?}; |
| if(#t11 =={core::Object::==}{(core::Object) → core::bool} "foo") { |
| #t2 = 3; |
| #t3 = true; |
| } |
| } |
| } |
| if(!#t3) { |
| final dynamic #t12 = #t1; |
| if(#t12 is self::Const<dynamic>) { |
| #t2 = 4; |
| #t3 = true; |
| } |
| } |
| if(!#t3) { |
| final dynamic #t13 = #t1; |
| if(#t13 is self::Const<core::num>) { |
| #t2 = 5; |
| #t3 = true; |
| } |
| } |
| switch(#t2) { |
| #L2: |
| case #C9: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L3: |
| case #C10: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L4: |
| case #C11: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L5: |
| case #C12: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L6: |
| case #C13: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L7: |
| case #C14: |
| { |
| { |
| matched = true; |
| break #L1; |
| } |
| } |
| #L8: |
| default: |
| { |
| matched = false; |
| break #L1; |
| } |
| } |
| } |
| if(!(matched =={core::Object::==}{(core::Object) → core::bool} expected)) { |
| core::print("FAIL: ${value} ${matched ?{core::String} "matched" : "didn't match"}"); |
| } |
| } |
| |
| constants { |
| #C1 = 42 |
| #C2 = <core::int*>[#C1] |
| #C3 = <core::num*>[#C1] |
| #C4 = "foo" |
| #C5 = <core::int*, core::String*>{#C1:#C4) |
| #C6 = <core::num*, core::Object*>{#C1:#C4) |
| #C7 = self::Const<core::int*> {value:#C1} |
| #C8 = self::Const<core::num*> {value:#C1} |
| #C9 = 0 |
| #C10 = 1 |
| #C11 = 2 |
| #C12 = 3 |
| #C13 = 4 |
| #C14 = 5 |
| } |
| |
| |
| Constructor coverage from constants: |
| org-dartlang-testcase:///implicit_constant_in_switch.dart: |
| - Const. (from org-dartlang-testcase:///implicit_constant_in_switch.dart:10:9) |
| - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart) |