-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Confusing parsing error when defining a val named _root_
with a type
#18020
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
|
This issue was picked for the Issue Spree No. 33 of 11 July 2023 which takes place in 7 days. @dwijnand, @nmcb, @jan-pieter will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
This isn't specific to scala> val foo String = "abc"
-- [E032] Syntax Error: --------------------------------------------------------
1 |val foo String = "abc"
| ^
| pattern expected
|
| longer explanation available when compiling with `-explain` But perhaps we can get the parser to realise that when it fails to find the infix op, too look if the first part (the LHS of the infix op), ends in a Alternatively, it would be nice if |
Compare #16072 |
References #18020, didn't actually fix that, because it addressed aspects of using `_root_` in definitions. Adding more details to that ticket. Fixes #17757 Fixes #18050 Includes the code in scala/bug#12508
Compiler version
main
(and also in Scala 2)Minimized code
Output
Expectation
If you leave out the type, it will compile:
So this one with a type annotation should compile as well?
Found together with @jan-pieter @nmcb when working on #18019
The text was updated successfully, but these errors were encountered: