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

Tighten unary op syntax and untupling language #14372

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

som-snytt
Copy link
Contributor

Fixes #9241

Disallow unary ops with parens.

Follow up untupling spec where it is not pattern-matching like .tupled. It simply takes the params it knows to take.

Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk 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

docs/docs/reference/changed-features/operators.md Outdated Show resolved Hide resolved
docs/docs/reference/changed-features/operators.md Outdated Show resolved Hide resolved
@som-snytt
Copy link
Contributor Author

It's not obvious to me that the reason I can't define

def unary_!() = false

is that I wouldn't be able to write prefix op syntax. What if I had no intention of using prefix op syntax? Perhaps my purpose was to sabotage prefix syntax for subclasses.

This is probably the only case where syntax restricts a regular language feature. For example, I can write extensions for StringContext that cannot be used as an interpolator.

@som-snytt
Copy link
Contributor Author

I used github's "commit suggestion" feature for the first time, but I see that it triggers tests.

@som-snytt
Copy link
Contributor Author

Rebased for conflicts, but accidentally lost review tweaks added via suggested edits.

Re-added tweaks per review.

@anatoliykmetyuk anatoliykmetyuk merged commit 808c669 into scala:main Mar 8, 2022
@som-snytt som-snytt deleted the issue/9241 branch March 8, 2022 14:37
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.

Disallow nilary (empty parenthesis) of prefix unary methods
2 participants