-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Eta-expansion of structural types under Scala2 mode #4026
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
We will not fix this in Dotty. Ping @olafurpg. It would be nice if Scalafix could add parenthesis to to nullary method calls. |
@allanrenucci I made some progress a while ago (scalacenter/scalafix#204) but I'm currently blocked by the fact that scalac signatures don't distinguish between non-nullary methods and nullary methods that override non-nullary methods (includes any 0-arg java method). trait A {
def overridesNonNullary(): String
}
object B extends A {
override def overridesNonNullary: String = "" // inherits non-nullary signature
def isNonNullary() = ???
} According to the SLS:
See scala/bug#10480 (comment) for discussion. As a workaround the rewrite should maybe skip methods that override non-nullary methods. |
Dotty will emit a warning under Scala2 mode for nullary methods that inherit non-nullary methods. So I guess that's fine, you could have another rewrite based on the warning emitted by dotc. However can you rewrite the call site when the receiver type is a structural type (as shown in the example above)? |
That should be doable, noted. |
Uh oh!
There was an error while loading. Please reload this page.
Under Scala2 mode this does not compile:
This is inconsistent with non structural types and a breaking change with respect to Scala2
The text was updated successfully, but these errors were encountered: