| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:35:16: Error: Type 'A' of the case expression is not a subtype of type 'B' of this switch expression. |
| // - 'A' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'. |
| // - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'. |
| // case const A(42): // Error: not a subtype of B. |
| // ^ |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here. |
| // switch (b) { |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Type 'dynamic' of the case expression is not a subtype of type 'B' of this switch expression. |
| // - 'B' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'. |
| // case x: // Error: D has custom operator ==. |
| // ^ |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:30:11: Context: The switch expression is here. |
| // switch (b) { |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:37:16: Error: Case expression 'D {}' does not have a primitive operator '=='. |
| // - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'. |
| // case const D(42): // Error: D has custom operator ==. |
| // ^ |
| // |
| // pkg/front_end/testcases/nnbd/switch_redesign_types.dart:39:10: Error: Case expression 'D {}' does not have a primitive operator '=='. |
| // - 'D' is from 'pkg/front_end/testcases/nnbd/switch_redesign_types.dart'. |
| // case x: // Error: D has custom operator ==. |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class A extends core::Object /*hasConstConstructor*/ { |
| final field core::int foo; |
| const constructor •(core::int foo) → self::A |
| : self::A::foo = foo, super core::Object::•() |
| ; |
| } |
| class B extends self::A /*hasConstConstructor*/ { |
| const constructor •(core::int foo) → self::B |
| : super self::A::•(foo) |
| ; |
| } |
| class C extends self::B /*hasConstConstructor*/ { |
| const constructor •(core::int foo) → self::C |
| : super self::B::•(foo) |
| ; |
| } |
| class D extends self::B /*hasConstConstructor*/ { |
| const constructor •(core::int foo) → self::D |
| : super self::B::•(foo) |
| ; |
| operator ==(dynamic other) → core::bool |
| return core::identical(this, other); |
| } |
| static method bar(self::B b) → dynamic { |
| #L1: |
| switch(b) { |
| #L2: |
| case #C2: |
| { |
| break #L1; |
| } |
| #L3: |
| case #C3: |
| { |
| break #L1; |
| } |
| #L4: |
| case #C4: |
| { |
| break #L1; |
| } |
| #L5: |
| case #C5: |
| { |
| break #L1; |
| } |
| #L6: |
| case #C7: |
| { |
| break #L1; |
| } |
| #L7: |
| default: |
| {} |
| } |
| } |
| static method main() → dynamic {} |
| |
| constants { |
| #C1 = 42 |
| #C2 = self::B {foo:#C1} |
| #C3 = self::C {foo:#C1} |
| #C4 = self::A {foo:#C1} |
| #C5 = self::D {foo:#C1} |
| #C6 = 123 |
| #C7 = self::D {foo:#C6} |
| } |
| |
| |
| Constructor coverage from constants: |
| org-dartlang-testcase:///switch_redesign_types.dart: |
| - D. (from org-dartlang-testcase:///switch_redesign_types.dart:23:9) |
| - B. (from org-dartlang-testcase:///switch_redesign_types.dart:15:9) |
| - A. (from org-dartlang-testcase:///switch_redesign_types.dart:11:9) |
| - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9) |
| - C. (from org-dartlang-testcase:///switch_redesign_types.dart:19:9) |