Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust objectPattern to allow Function() #3496

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions accepted/3.0/patterns/feature-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ pattern with the field name omitted (see name inference below).
### Object pattern

```
objectPattern ::= typeName typeArguments? '(' patternFields? ')'
objectPattern ::=
(typeName typeArguments? | (typeIdentifier '.')? 'Function')
'(' patternFields? ')'
```

An object pattern matches values of a given named type and then extracts values
Expand Down Expand Up @@ -1924,7 +1926,7 @@ To type check a pattern `p` being matched against a value of type `M`:
performed. Otherwise *(when `M` is not `dynamic` or `Never`)*:

1. A compile-time error occurs if `M` does not have an operator `op`,
and there is no available and applicable extension operator `op`.
and there is no available and applicable extension operator `op`.
Let `A` be the type of the formal parameter of the given operator
declaration, and let `R` be the return type.

Expand Down Expand Up @@ -3550,6 +3552,11 @@ Here is one way it could be broken down into separate pieces:

## Changelog

### 2.34 (after shipping)

- Adjust `objectPattern` to allow `Function(...)`, which is already
the implemented behavior (#3468).

### 2.33 (after shipping)

- Tweak caching of trailing list elements after a rest element. The specified
Expand Down