-
Notifications
You must be signed in to change notification settings - Fork 1.1k
targetName with AnyVal affects multiple methods, which can cause invalid bytecode #16464
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
Labels
Milestone
Comments
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 9, 2022
…ue classes Before target name we only matched on signatures. This was OK, since multiple extension methods of the same class must be different, otherwise we will get a "have the same erasure" error later at erasurePhase. But with @TargetNAME that's now a legal situation that needs to be resolve correctly. We do this by propagating the target name to the extension method and verifiying that the target names of the original and extension methods match. Fixes scala#16464
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Dec 9, 2022
…ue classes Before target name we only matched on signatures. This was OK, since multiple extension methods of the same class must be different, otherwise we will get a "have the same erasure" error later at erasurePhase. But with @TargetNAME that's now a legal situation that needs to be resolve correctly. We do this by propagating the target name to the extension method and verifiying that the target names of the original and extension methods match. Fixes scala#16464
smarter
added a commit
that referenced
this issue
Dec 12, 2022
Take @TargetNAME into account when resolving extension methods of value classes Before target name we only matched on signatures. This was OK, since multiple extension methods of the same class must be different, otherwise we will get a "have the same erasure" error later at erasurePhase. But with @TargetNAME that's now a legal situation that needs to be resolved correctly. We do this by propagating the target name to the extension method and verifying that the target names of the original and extension methods match. Fixes #16464
little-inferno
pushed a commit
to little-inferno/dotty
that referenced
this issue
Jan 25, 2023
…ue classes Before target name we only matched on signatures. This was OK, since multiple extension methods of the same class must be different, otherwise we will get a "have the same erasure" error later at erasurePhase. But with @TargetNAME that's now a legal situation that needs to be resolve correctly. We do this by propagating the target name to the extension method and verifiying that the target names of the original and extension methods match. Fixes scala#16464
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.2.1
Minimized code
Output
Brief analysis
The implementing class seems to use name "b" for both methods:
The bytecode of the wrapper class seems to be valid, but even the
a
method calls themain$package$SomeOps$.b:(ILscala/collection/immutable/Seq;)Lscala/runtime
:Expectation
I expect:
main$package$SomeOps$
to be valid andscala.NotImplementedError: an implementation is missing
andmain$package$SomeOps.a(scala.collection.immutable.Seq)
to call a, not b. (i.e.,main$package$SomeOps$.a:(ILscala/collection/immutable/Seq;)Lscala/runtime
, notmain$package$SomeOps$.b:(ILscala/collection/immutable/Seq;)Lscala/runtime
)The text was updated successfully, but these errors were encountered: