Skip to content

[SR-7492][4.2] Project over-parenthesized patterns properly #16192

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
Apr 27, 2018

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Apr 26, 2018

Cherry-picked from #16189.

Original rationale:

Projection assumed if it ever hit a case where an argument pattern
contained extra parentheses that the user was trying to create
a var pattern to bind the entire argument tuple.

enum Foo {
  case bar(Int, String, Float)
}

switch fooVal {
  case bar(let x): ...
}

This breaks in the presence of tuple patterns with extra parentheses.
Treat these patterns explicitly when projecting them.

@xedin One more review for good measure?

Projection assumed if it ever hit a case where an argument pattern
contained extra parentheses that the user was trying to create
a var pattern to bind the entire argument tuple.

enum Foo {
  case bar(Int, String, Float)
}

switch fooVal {
  case bar(let x): ...
}

This breaks in the presence of tuple patterns with extra parentheses.
Treat these patterns explicitly when projecting them.
@CodaFi CodaFi requested a review from xedin April 26, 2018 21:14
@CodaFi
Copy link
Contributor Author

CodaFi commented Apr 26, 2018

@swift-ci please test

@CodaFi
Copy link
Contributor Author

CodaFi commented Apr 27, 2018

@swift-ci please test macOS platform

@CodaFi
Copy link
Contributor Author

CodaFi commented Apr 27, 2018

⛵️

@CodaFi CodaFi merged commit 69b0471 into swiftlang:swift-4.2-branch Apr 27, 2018
@CodaFi CodaFi deleted the paren-oid-android branch April 27, 2018 03:48
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