| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:22:11: Error: The type 'Enum' is not exhaustively matched by the switch cases since it doesn't match 'Enum.c'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.c'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:33:11: Error: The type 'Enum' is not exhaustively matched by the switch cases since it doesn't match 'Enum.b'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.b'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:44:11: Error: The type 'Enum' is not exhaustively matched by the switch cases since it doesn't match 'Enum.a'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.a'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:55:11: Error: The type 'Enum' is not exhaustively matched by the switch cases since it doesn't match 'Enum.a'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.a'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:91:11: Error: The type 'Enum?' is not exhaustively matched by the switch cases since it doesn't match 'null'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'null'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:105:11: Error: The type 'Enum?' is not exhaustively matched by the switch cases since it doesn't match 'Enum.b'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.b'. |
| // switch (e) /* Error */ { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart:136:11: Error: The type 'Enum' is not exhaustively matched by the switch cases since it doesn't match 'Enum.c'. |
| // - 'Enum' is from 'pkg/front_end/testcases/patterns/exhaustiveness/enum_switch.dart'. |
| // Try adding a default case or cases that match 'Enum.c'. |
| // switch (e) /* Non-exhaustive */ { |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class Enum extends core::_Enum /*isEnum*/ { |
| static const field core::List<self::Enum> values = #C10; |
| enum-element static const field self::Enum a = #C3; |
| enum-element static const field self::Enum b = #C6; |
| enum-element static const field self::Enum c = #C9; |
| const constructor •(core::int #index, core::String #name) → self::Enum |
| : super core::_Enum::•(#index, #name) |
| ; |
| method _enumToString() → core::String |
| return "Enum.${this.{core::_Enum::_name}{core::String}}"; |
| } |
| class GenericEnum<T extends core::Object? = dynamic> extends core::_Enum /*isEnum*/ { |
| static const field core::List<self::GenericEnum<dynamic>> values = #C14; |
| enum-element static const field self::GenericEnum<core::int> a = #C11; |
| enum-element static const field self::GenericEnum<core::String> b = #C12; |
| enum-element static const field self::GenericEnum<core::bool> c = #C13; |
| const constructor •(core::int #index, core::String #name) → self::GenericEnum<self::GenericEnum::T%> |
| : super core::_Enum::•(#index, #name) |
| ; |
| method _enumToString() → core::String |
| return "GenericEnum.${this.{core::_Enum::_name}{core::String}}"; |
| } |
| static method exhaustiveSwitch(self::Enum e) → void { |
| #L1: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L2: |
| case #C3: |
| { |
| core::print("a"); |
| break #L1; |
| } |
| #L3: |
| case #C6: |
| { |
| core::print("b"); |
| break #L1; |
| } |
| #L4: |
| case #C9: |
| { |
| core::print("c"); |
| break #L1; |
| } |
| } |
| } |
| static method nonExhaustiveSwitch1(self::Enum e) → void { |
| #L5: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L6: |
| case #C3: |
| { |
| core::print("a"); |
| break #L5; |
| } |
| #L7: |
| case #C6: |
| { |
| core::print("b"); |
| break #L5; |
| } |
| } |
| } |
| static method nonExhaustiveSwitch2(self::Enum e) → void { |
| #L8: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L9: |
| case #C3: |
| { |
| core::print("a"); |
| break #L8; |
| } |
| #L10: |
| case #C9: |
| { |
| core::print("c"); |
| break #L8; |
| } |
| } |
| } |
| static method nonExhaustiveSwitch3(self::Enum e) → void { |
| #L11: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L12: |
| case #C6: |
| { |
| core::print("b"); |
| break #L11; |
| } |
| #L13: |
| case #C9: |
| { |
| core::print("c"); |
| break #L11; |
| } |
| } |
| } |
| static method nonExhaustiveSwitch4(self::Enum e) → void { |
| #L14: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L15: |
| case #C6: |
| { |
| core::print("b"); |
| break #L14; |
| } |
| } |
| } |
| static method nonExhaustiveSwitchWithDefault(self::Enum e) → void { |
| #L16: |
| switch(e) { |
| #L17: |
| case #C6: |
| { |
| core::print("b"); |
| break #L16; |
| } |
| #L18: |
| default: |
| { |
| core::print("a|c"); |
| break #L16; |
| } |
| } |
| } |
| static method exhaustiveNullableSwitch(self::Enum? e) → void { |
| #L19: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L20: |
| case #C3: |
| { |
| core::print("a"); |
| break #L19; |
| } |
| #L21: |
| case #C6: |
| { |
| core::print("b"); |
| break #L19; |
| } |
| #L22: |
| case #C9: |
| { |
| core::print("c"); |
| break #L19; |
| } |
| #L23: |
| case #C15: |
| { |
| core::print("null"); |
| break #L19; |
| } |
| } |
| } |
| static method nonExhaustiveNullableSwitch1(self::Enum? e) → void { |
| #L24: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L25: |
| case #C3: |
| { |
| core::print("a"); |
| break #L24; |
| } |
| #L26: |
| case #C6: |
| { |
| core::print("b"); |
| break #L24; |
| } |
| #L27: |
| case #C9: |
| { |
| core::print("c"); |
| break #L24; |
| } |
| } |
| } |
| static method nonExhaustiveNullableSwitch2(self::Enum? e) → void { |
| #L28: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L29: |
| case #C3: |
| { |
| core::print("a"); |
| break #L28; |
| } |
| #L30: |
| case #C9: |
| { |
| core::print("c"); |
| break #L28; |
| } |
| #L31: |
| case #C15: |
| { |
| core::print("null"); |
| break #L28; |
| } |
| } |
| } |
| static method unreachableCase1(self::Enum e) → void { |
| #L32: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L33: |
| case #C3: |
| { |
| core::print("a1"); |
| break #L32; |
| } |
| #L34: |
| case #C6: |
| { |
| core::print("b"); |
| break #L32; |
| } |
| #L35: |
| case #C3: |
| { |
| core::print("a2"); |
| break #L32; |
| } |
| #L36: |
| case #C9: |
| { |
| core::print("c"); |
| break #L32; |
| } |
| } |
| } |
| static method unreachableCase2(self::Enum e) → void { |
| #L37: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L38: |
| case #C3: |
| { |
| core::print("a1"); |
| break #L37; |
| } |
| #L39: |
| case #C6: |
| { |
| core::print("b"); |
| break #L37; |
| } |
| #L40: |
| case #C3: |
| { |
| core::print("a2"); |
| break #L37; |
| } |
| } |
| } |
| static method unreachableCase3(self::Enum e) → void { |
| #L41: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L42: |
| case #C3: |
| { |
| core::print("a"); |
| break #L41; |
| } |
| #L43: |
| case #C6: |
| { |
| core::print("b"); |
| break #L41; |
| } |
| #L44: |
| case #C9: |
| { |
| core::print("c"); |
| break #L41; |
| } |
| #L45: |
| case #C15: |
| { |
| core::print("null"); |
| break #L41; |
| } |
| } |
| } |
| static method unreachableCase4(self::Enum? e) → void { |
| #L46: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L47: |
| case #C3: |
| { |
| core::print("a"); |
| break #L46; |
| } |
| #L48: |
| case #C6: |
| { |
| core::print("b"); |
| break #L46; |
| } |
| #L49: |
| case #C9: |
| { |
| core::print("c"); |
| break #L46; |
| } |
| #L50: |
| case #C15: |
| { |
| core::print("null1"); |
| break #L46; |
| } |
| #L51: |
| case #C15: |
| { |
| core::print("null2"); |
| break #L46; |
| } |
| } |
| } |
| static method exhaustiveGenericSwitch(self::GenericEnum<dynamic> e) → void { |
| #L52: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L53: |
| case #C11: |
| { |
| core::print("a"); |
| break #L52; |
| } |
| #L54: |
| case #C12: |
| { |
| core::print("b"); |
| break #L52; |
| } |
| #L55: |
| case #C13: |
| { |
| core::print("c"); |
| break #L52; |
| } |
| } |
| } |
| static method exhaustiveGenericSwitchTyped(self::GenericEnum<core::int> e) → void { |
| #L56: |
| switch(e) /*isExplicitlyExhaustive*/ { |
| #L57: |
| case #C11: |
| { |
| core::print("a"); |
| break #L56; |
| } |
| } |
| } |
| |
| constants { |
| #C1 = 0 |
| #C2 = "a" |
| #C3 = self::Enum {index:#C1, _name:#C2} |
| #C4 = 1 |
| #C5 = "b" |
| #C6 = self::Enum {index:#C4, _name:#C5} |
| #C7 = 2 |
| #C8 = "c" |
| #C9 = self::Enum {index:#C7, _name:#C8} |
| #C10 = <self::Enum>[#C3, #C6, #C9] |
| #C11 = self::GenericEnum<core::int> {index:#C1, _name:#C2} |
| #C12 = self::GenericEnum<core::String> {index:#C4, _name:#C5} |
| #C13 = self::GenericEnum<core::bool> {index:#C7, _name:#C8} |
| #C14 = <self::GenericEnum<dynamic>>[#C11, #C12, #C13] |
| #C15 = null |
| } |
| |
| |
| Constructor coverage from constants: |
| org-dartlang-testcase:///enum_switch.dart: |
| - Enum. (from org-dartlang-testcase:///enum_switch.dart:5:6) |
| - _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart) |
| - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart) |
| - GenericEnum. (from org-dartlang-testcase:///enum_switch.dart:187:6) |