Skip to content

Fix #4935: make desugaring optimization sound #6309

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 2 commits into from
Apr 16, 2019

Conversation

liufengyun
Copy link
Contributor

Fix #4935: remove unsound optimization

We can only optimize `val pat = if (...) e1 else e2` if:

- `e1` and `e2` are both tuples of arity N
- `pat` is a tuple of N variables or wildcard patterns like `(x1, x2, ..., xN)`

Otherwise, we need to generate pattern matches.
@liufengyun liufengyun changed the title Fix #4935: remove unsound optimization Fix #4935: make desugaring optimization sound Apr 15, 2019
@liufengyun liufengyun requested a review from odersky April 16, 2019 12:04
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@odersky odersky assigned liufengyun and unassigned odersky Apr 16, 2019
@liufengyun liufengyun merged commit 5c4d462 into scala:master Apr 16, 2019
@liufengyun liufengyun deleted the fix-4935 branch April 16, 2019 15:09
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.

Weird behavior with pattern matching.
2 participants