Skip to content

Commit 42cf822

Browse files
committed
Actually make it an error to have an empty map pattern.
Fix #2962.
1 parent ada0410 commit 42cf822

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

accepted/future-releases/0546-patterns/feature-specification.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ rest element with no subpattern as a *non-matching rest element*.
602602
### Map pattern
603603

604604
```
605-
mapPattern ::= typeArguments? '{' mapPatternEntries? '}'
605+
mapPattern ::= typeArguments? '{' mapPatternEntries '}'
606606
mapPatternEntries ::= mapPatternEntry ( ',' mapPatternEntry )* ','?
607607
mapPatternEntry ::= expression ':' pattern
608608
```
@@ -621,6 +621,9 @@ It is a compile-time error if:
621621
expressions in a future release without it being a breaking change, similar
622622
to default values in parameter lists.*
623623

624+
*Note that `mapPatternEntries` is not optional, which means it is an error for
625+
a map pattern to be empty.*
626+
624627
*Note that we don't require map keys to have primitive equality, to enable
625628
more flexibility in key types.*
626629

0 commit comments

Comments
 (0)