-
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
Overloading regression in Scala 3 #14699
Comments
I guess it works in 2.13 not because of specificity but because "if the result expr of the block is omitted, unit is assumed".
I thought 2.13 preferred non-varargs, but by tupling and discarding
Tangentially, #14700 |
I think this is indeed ambiguous according to spec. |
The expectation is that if it works with explicit unit value, it should work when the unit value is implicit. Only one alternative is applicable.
|
Maybe the behavior is undefined according to the spec, but it's not defined that it's illegal as well. So where the spec is ambiguous/undefined we turn to the existing implementation. The Scala 2 compiler implementation accepts this as legal code. Therefore, I think we need to stick to that as the de facto specified behavior and treat the Scala 3 implementation as a regression. |
@soronpo That comment meant that unapplied I think my previous comment is the correct interpretation of |
I misread the example. In fact there is no ambiguity. |
Thank you @odersky |
The following works in 2.13, but fails in Scala 3.
Compiler version
v3.1.2-RC1
Minimized code
https://scastie.scala-lang.org/eiWBjoMFRiWNNuBRV2oH2g
Output
Expectation
No error, same as in Scala 2.13
The text was updated successfully, but these errors were encountered: