-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Disallow nilary (empty parenthesis) of prefix unary methods #9241
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
Comments
It's not quite clear how this should be done. Do you want to disallow all parameters on methods named unary_n? what exactly is the pattern? I fear we will need quite a bit of spec language to cover this. Also, is it really worth it? With a single unit test for your operator you'll find out that this will not work. |
This is the same as #6192 which we closed without solving it. |
There was a PR submitted to Scala 2 to resolve this issue: |
The PR in Scala 2 is sufficient enough. It removes a single empty-parent option from |
I note that #9085 comes without a spec, which makes it incomplete. I would be interested to see what a spec would look like. I suspect it would look rather out of place. |
A spec would be very similar to number 3. in https://dotty.epfl.ch/docs/reference/changed-features/operators.html#details-1. Something like:
|
I think somebody else should take this on. |
Uh oh!
There was an error while loading. Please reload this page.
Same as Scala 2 bug scala/bug#12055
Minimized code
https://scastie.scala-lang.org/NKZQM3d8RrGYRYFoewJyQw
Expectation
Auto-application is disallowed and there a prefix def with a nilary(empty parenthesis) creates an error that cannot be avoided while maintaining a prefix position. To resolve this, we need to deprecate this possibility from the definition site.
The text was updated successfully, but these errors were encountered: