-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Inconsistent parsing of symbols wrapped in backticks #15547
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
Not sure of the source of the discrepancy but I'm getting slightly different errors with the same compiler version when trying to compile this locally [error] Bug.scala:5:30: end of toplevel definition expected but string literal found
[error] val withPlus: String = `+` + "3"
[error] ^
[error] Bug.scala:5:24: value unary_+ is not a member of String
[error] val withPlus: String = `+` + "3"
[error] ^^^^^ The point is that def + : String = "+" instead of def `+`: String = "+" while def = : String = "=" would be syntactically incorrect. + + "3"
`+` + "3"
+ `+` "3"
`+` `+` "3" mean the same and the first |
I can't reproduce this on latest main. Everything compiles. I remember we had a PR recently that changed the status of backticked unary operators. Maybe that fixed it. |
Indeed seems to be fixed by #15198 |
was
now
Noting that |
Compiler version
3.1.2
Minimized code
Output
Compile error on the last line:
See https://scastie.scala-lang.org/WCnbXR7RRzOuc8zYkrlxUQ for a "live" reproduction
Expectation
Either a compile error for both
withEq
andwithPlus
, or none, but this seems inconsistent.The text was updated successfully, but these errors were encountered: