-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Question about method '+=' on ArrayBuilder[Unit] #9132
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
Scala 2 parses |
This ticket may be used to forward-port the improvement at scala/scala#7684 which is in 2.13.0. |
The code After filling the Parsers.scala file with prints I added the line After this change the previous tree is replaced with I probably broke a lot of stuff. But for this particular case, I got the result that I was expecting after the typer phase.
instead
|
Without much surprise |
I am surprised at Scala 2's behavior here. Here is another example: Console.println ()
Console println () parses as Console.println();
Console.println(()) and prints one But with the changes intended for auto-tupling in mind we should parse it the same way as Scala 2. |
The Scala 2 PR refers to an earlier PR scala/scala#6974 that says "Remove adaptation of 0-arg methods under -Xsource:3.0", so that was the context. Two years ago, we weren't yet comparing Dotty behavior as carefully as now. In fact,
|
@som-snytt Thanks for giving the context. Things goes in the right direction. In fact it turns out that Dotty does parse the argument as an empty tuple, but then the pretty printer fooled us in dropping the extra pair of parentheses. The Tuple gets replaced with an empty argument list in desugaring. |
Fix #9132: Align with Scala 2's handling of () infix arguments
Minimized example
Output
Compiles on Scala 2.13.2 but not on Dotty
Expectation
Created this issue so we can officialize if this is the intended behavior or not. In order to see what to do on scala-js/scala-js#4071
The discussion starts Gitter where @smarter and @sjrd participated
https://gitter.im/lampepfl/dotty?at=5ede17109da05a060a5b9b14
The text was updated successfully, but these errors were encountered: