-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Named tuples are ambigious in (new) given syntax #22237
Comments
The |
@SrTobi The following code compiles correctly: //> using scala 3.nightly
import scala.language.experimental.namedTuples
given (x: Int) = ??? |
Ah ok... I was confused by the fact that Also the example doesn't even relate to what I mean with the above mentioned ambiguity. The example I should have given (pun intended) is: Not sure if you want to change anything in the grammar. if not feel free to close this issue. Thx |
Good point, this one indeed appears to be ambiguous. Though any changes to the grammar will most likely reflect the current behavior. |
|
@sjrd it's not about |
Compiler version
3.6.2
with-experimental
Minimized example
I'm currently implementing the new given syntax parsing for the intellij-scala plugin and I stumbled about this:
Output
The compiler gives
')' expected, but ':' found
as error message.Expectation
According to the grammar the above code should be allowed
as named tuples are part of SimpleType.
Here the relevant grammar:
DefTermParamClause
andGivenType
can look the same ((x: Int)
for example)I know that it doesn't make too much sense to have a named tuple in that position, still I'd like to know if that is intentional or not. Just so I don't have to implement and test our parser twice 😀
In the case that is should stay disallowed, I'd suggest changing the error message either to
=> expected
after the)
or something likenamed tuples are not allowed in this position
The text was updated successfully, but these errors were encountered: