Skip to content

Commit f06d416

Browse files
committed
[pattern] Grammar tweaks.
- Use `typeName` for `objectPattern`. - Add metadata to new declaration forms. Fix #2621.
1 parent 7939e9f commit f06d416

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,7 @@ to the error than silently accept it.*
688688
### Object pattern
689689

690690
```
691-
objectPattern ::= objectName typeArguments? '(' patternFields? ')'
692-
objectName ::= typeIdentifier | qualifiedName
691+
objectPattern ::= typeName typeArguments? '(' patternFields? ')'
693692
```
694693

695694
An object pattern matches values of a given named type and then extracts values
@@ -824,12 +823,12 @@ variables like so:
824823

825824
```
826825
localVariableDeclaration ::=
827-
| initializedVariableDeclaration ';' // Existing.
828-
| patternVariableDeclaration ';' // New.
826+
| metadata initializedVariableDeclaration ';' // Existing.
827+
| metadata patternVariableDeclaration ';' // New.
829828
830829
forLoopParts ::=
831830
| // Existing productions...
832-
| ( 'final' | 'var' ) outerPattern 'in' expression // New.
831+
| metadata ( 'final' | 'var' ) outerPattern 'in' expression // New.
833832
```
834833

835834
As with regular for-in loops, it is a compile-time error if the type of

0 commit comments

Comments
 (0)