mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:11:19 +00:00
Update test for 2.29/2.30 changes to map patterns.
It is still an error to have duplicate keys. Change-Id: Id86fa7b50c3620540f4bef0399f5f70316848662 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292125 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
4cd53dbb2e
commit
15e5ec93f3
|
@ -38,9 +38,8 @@ main() {
|
|||
case {'b': _}:
|
||||
print('b');
|
||||
case {'a': _, 'b': _}:
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] This case is covered by the previous cases.
|
||||
// ^^^^
|
||||
// [analyzer] HINT.UNREACHABLE_SWITCH_CASE
|
||||
print('a b');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,6 @@ import "package:expect/expect.dart";
|
|||
main() {
|
||||
var map = {'a': 1, 'b': 2};
|
||||
|
||||
// Map patterns are allowed to have identical keys.
|
||||
Expect.isTrue(switch (map) { {'a': _, 'a': _} => true, _ => false });
|
||||
|
||||
// Map patterns are allowed to have primitive equal record keys.
|
||||
Expect.isTrue(switch ({('c', 'd'): 3}) {
|
||||
{('c', 'd'): _, ('c', 'd'): _} => true,
|
||||
_ => false
|
||||
});
|
||||
|
||||
// Map patterns don't access length.
|
||||
Expect.isTrue(
|
||||
switch (NoLengthMap(map)) { {'a': _, 'a': _} => true, _ => false });
|
||||
|
|
Loading…
Reference in a new issue