-
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
Inner traits get outer pointer only if needed #17148
Comments
previous discussions in this area include #2156 (2017) and scala/bug#4440 (2011) "In dotty, if a subclass needs an outer accessor, it gets one" — Martin (so presumably this exception was inadvertent, rather than a design decision) |
Changing this (adding the So if an inner trait is re-compiled with a new version of the compiler, it acquires an abstract outer method, which would show up in MiMa. |
Unless there is some flaw in our reasoning here, seems like we can't fix this until Scala 4 and the best we can do in 3.x is warn at the pattern match site 😕 (“our” = me, Lukas, @sjrd at the Center today) |
Scala 2.13.11 warns at the pattern:
|
This fails because
T
doesn't get anouter
method, so thecase _: o.T
check cannot compare the outer values. The compiler also doesn't warn about that.Un-commenting the method
def g
adds an outer method to traitT
, which changes the match evaluation.The text was updated successfully, but these errors were encountered: