| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/object_pattern.dart:28:41: Error: The type 'A' is not exhaustively matched by the switch cases since it doesn't match 'A(field1: int())'. |
| // - 'A' is from 'pkg/front_end/testcases/patterns/exhaustiveness/object_pattern.dart'. |
| // Try adding a wildcard pattern or cases that match 'A()'. |
| // nonExhaustiveFixedField(A a) => switch (a) { |
| // ^ |
| // |
| // pkg/front_end/testcases/patterns/exhaustiveness/object_pattern.dart:32:41: Error: The type 'A' is not exhaustively matched by the switch cases since it doesn't match 'A(field2: double())'. |
| // - 'A' is from 'pkg/front_end/testcases/patterns/exhaustiveness/object_pattern.dart'. |
| // Try adding a wildcard pattern or cases that match 'A(field2: double())'. |
| // nonExhaustiveTypedField(A a) => switch (a) { |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:_internal" as _in; |
| |
| class A extends core::Object { |
| field core::int field1; |
| field core::num field2; |
| constructor •(core::int field1, core::num field2) → self::A |
| : self::A::field1 = field1, self::A::field2 = field2, super core::Object::•() |
| ; |
| } |
| static method exhaustiveDirect(self::A a) → dynamic |
| return block { |
| core::int #t1; |
| final synthesized self::A #0#0 = a; |
| #L1: |
| { |
| { |
| if(true) { |
| #t1 = 0; |
| break #L1; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t1; |
| static method exhaustiveWithWildcards(self::A a) → dynamic |
| return block { |
| core::int #t2; |
| final synthesized self::A #0#0 = a; |
| #L2: |
| { |
| { |
| if((let final core::int #t3 = #0#0.{self::A::field1}{core::int} in true) && (let final core::num #t4 = #0#0.{self::A::field2}{core::num} in true)) { |
| #t2 = 0; |
| break #L2; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t2; |
| static method exhaustiveWithFields(self::A a) → dynamic |
| return block { |
| core::int #t5; |
| final synthesized self::A #0#0 = a; |
| #L3: |
| { |
| { |
| hoisted core::int field1; |
| hoisted core::num field2; |
| if(true) { |
| field1 = #0#0.{self::A::field1}{core::int}; |
| field2 = #0#0.{self::A::field2}{core::num}; |
| #t5 = 0; |
| break #L3; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t5; |
| static method exhaustiveWithTypedFields(self::A a) → dynamic |
| return block { |
| core::int #t6; |
| final synthesized self::A #0#0 = a; |
| synthesized core::int #0#1; |
| synthesized core::bool #0#1#isSet = false; |
| synthesized core::num #0#2; |
| synthesized core::bool #0#2#isSet = false; |
| #L4: |
| { |
| { |
| hoisted core::int field1; |
| hoisted core::num field2; |
| if((#0#1#isSet ?{core::int} #0#1{core::int} : let final core::bool #t7 = #0#1#isSet = true in #0#1 = #0#0.{self::A::field1}{core::int}) is core::int && (let final core::int #t8 = field1 = #0#1#isSet ?{core::int} #0#1{core::int} : let final core::bool #t9 = #0#1#isSet = true in #0#1 = #0#0.{self::A::field1}{core::int} in true) && (#0#2#isSet ?{core::num} #0#2{core::num} : let final core::bool #t10 = #0#2#isSet = true in #0#2 = #0#0.{self::A::field2}{core::num}) is core::num) { |
| field2 = #0#2#isSet ?{core::num} #0#2{core::num} : let final core::bool #t11 = #0#2#isSet = true in #0#2 = #0#0.{self::A::field2}{core::num}; |
| #t6 = 0; |
| break #L4; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t6; |
| static method nonExhaustiveFixedField(self::A a) → dynamic |
| return block { |
| core::int #t12; |
| final synthesized self::A #0#0 = a; |
| #L5: |
| { |
| { |
| if(#C1 =={core::num::==}{(core::Object) → core::bool} #0#0.{self::A::field1}{core::int}) { |
| #t12 = 0; |
| break #L5; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t12; |
| static method nonExhaustiveTypedField(self::A a) → dynamic |
| return block { |
| core::int #t13; |
| final synthesized self::A #0#0 = a; |
| synthesized core::num #0#1; |
| synthesized core::bool #0#1#isSet = false; |
| #L6: |
| { |
| { |
| hoisted core::int field2; |
| if((#0#1#isSet ?{core::num} #0#1{core::num} : let final core::bool #t14 = #0#1#isSet = true in #0#1 = #0#0.{self::A::field2}{core::num}) is core::int) { |
| field2 = (#0#1#isSet ?{core::num} #0#1{core::num} : let final core::bool #t15 = #0#1#isSet = true in #0#1 = #0#0.{self::A::field2}{core::num}) as{Unchecked} core::int; |
| #t13 = 0; |
| break #L6; |
| } |
| } |
| throw{for-error-handling} new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type."); |
| } |
| } =>#t13; |
| |
| constants { |
| #C1 = 5 |
| } |