Files
sdk/pkg/front_end/testcases/patterns/empty_map_pattern.dart.weak.modular.expect
T
Johnni Winther 31e119e594 [cfe] Report error on empty map pattern
This reports the error on empty map pattern and moves the reporting
of rest patterns in map patterns to the shared analysis.

Change-Id: I317d0c42a3bc7534462b1b9781c1f6471746fc0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292860
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-04-04 09:36:38 +00:00

38 lines
1.0 KiB
Plaintext

library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/patterns/empty_map_pattern.dart:6:7: Error: A map pattern must have at least one entry.
// Try replacing it with an object pattern 'Map()'.
// {} => 0,
// ^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
static method method(core::Map<dynamic, dynamic> m) → dynamic
return block {
core::int #t1;
final synthesized core::Map<dynamic, dynamic> #0#0 = m;
#L1:
{
{
if(invalid-expression "pkg/front_end/testcases/patterns/empty_map_pattern.dart:6:7: Error: A map pattern must have at least one entry.
Try replacing it with an object pattern 'Map()'.
{} => 0,
^") {
#t1 = 0;
break #L1;
}
}
{
if(true) {
#t1 = 1;
break #L1;
}
}
throw new _in::ReachabilityError::•("`null` encountered as case in a switch expression with a non-nullable type.");
}
} =>#t1;