Skip to content

[Parse] Avoid creating binding patterns in a couple more positions #66718

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

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

hamishknight
Copy link
Contributor

If we have an identifier followed by either [ or a generic argument list, avoid turning it into a binding pattern, as that would be invalid. This is similar to the existing rule we have where a following ( prevents a binding pattern from being formed.

This allows patterns such as let E<Int>.foo(x) and let (y[0], x) to compile, where x is treated as a binding, but no other identifier is.

rdar://108738034

If we have an identifier followed by either `[` or
a generic argument list, avoid turning it into a
binding pattern, as that would be invalid. This
is similar to the existing rule we have where a
following `(` prevents a binding pattern from
being formed.

This allows patterns such as `let E<Int>.foo(x)` and
`let (y[0], x)` to compile, where `x` is treated
as a binding, but no other identifier is.

rdar://108738034
@hamishknight
Copy link
Contributor Author

swiftlang/swift-syntax#1804

@swift-ci please test

@hamishknight hamishknight merged commit 8caf999 into swiftlang:main Jun 19, 2023
@hamishknight hamishknight deleted the getting-out-of-a-bind branch June 19, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants