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

Parse splices inside quoted patterns as patterns #14277

Merged
merged 2 commits into from
Jan 20, 2022

Conversation

adampauls
Copy link
Contributor

@adampauls adampauls commented Jan 15, 2022

A quick attempt at addressing the issue mentioned here. To summarize, right now, IIUC the parser treats the splice in case '{ foo(${ ...}) } no differently than a splice anywhere, meaning it can contain an arbitrary block, even though the typer will treat it as a pattern. This is relatively harmless, since the compiler will reject non-patterns, but it means that some syntax available in patterns is not permitted, like case '{ foo(${x@MyCustomUnapply(_)}) }. We would like to use binds within splices in case matches, which is why I noticed this problem.

I thought I'd put this up here for discussion. Please let me know if I'm misunderstanding how this is all supposed to work.

@nicolasstucki nicolasstucki self-assigned this Jan 17, 2022
@adampauls adampauls changed the title [WIP] Parse splices inside quoted patterns as patterns Parse splices inside quoted patterns as patterns Jan 17, 2022
@adampauls
Copy link
Contributor Author

I can't figure out how to rerun the community build, but I'm pretty sure it's just a flaky download error and not a real problem. This is ready for review.

@adampauls
Copy link
Contributor Author

(I rebased and the build problem seems to have resolved itself).

@nicolasstucki nicolasstucki merged commit 300a8b6 into scala:master Jan 20, 2022
@nicolasstucki
Copy link
Contributor

Thank you @adampauls

@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
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.

3 participants