-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ExplicitOuter doesn't match Scala 2.12's outer types #4342
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
I don't have much knowledge of the relevant code here, but this looks similar to what https://github.com/lampepfl/dotty/blob/2212dc0ea072614fabda1004d9cbb23401cba351/compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala#L51-L52 tries to address. |
@smarter Yeah, I was looking at that part. I'll just take a stab at it, then. |
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 19, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 20, 2018
…er, adapt to the old behavior in picking the outer parameter's type, i.e., prefer the enclosing class's self type, rather than the enclosing class itself.
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 20, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 20, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 20, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 20, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 21, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 21, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 21, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 21, 2018
gsps
added a commit
to gsps/dotty
that referenced
this issue
Apr 21, 2018
…er, adapt to the old behavior in picking the outer parameter's type, i.e., prefer the enclosing class's self type, rather than the enclosing class itself.
smarter
pushed a commit
to dotty-staging/dotty
that referenced
this issue
Jan 26, 2019
…er, adapt to the old behavior in picking the outer parameter's type, i.e., prefer the enclosing class's self type, rather than the enclosing class itself.
smarter
added a commit
that referenced
this issue
Jan 26, 2019
Fix #4342: Handle Scala2 method calls with an outer param
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scala 2.12 appears to use the declared self type of the enclosing class as the outer type when transforming inner classes. Dotty doesn't match this behavior and uses the enclosing class itself, leading to
NoSuchMethodErrors
wrt. Scala 2.12 classes upon executing the Dotty-compiled code. Here's a minimal example:Consider the following code, compiled with 2.12:
and the following code, compiled with Dotty:
We can see the discrepancy in the generated code. That is,
javap -p 'target/scala-2.12/classes/foo/B$C.class'
yields:whereas
javap -c Scala2_12FromDotty$.class
yieldsI tried to look into the related phases a bit, but I'm not sure whether this should be fixed in
ExplicitOuter
or by transforming infos, applications and defdefs later, for instance, as an extension ofLinkScala2Impls
.The text was updated successfully, but these errors were encountered: