Skip to content

Take @targetName into account when resolving extension methods #16487

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

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 9, 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

…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 smarter merged commit de26e9a into scala:main Dec 12, 2022
@smarter smarter deleted the fix-16464 branch December 12, 2022 09:58
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

targetName with AnyVal affects multiple methods, which can cause invalid bytecode
3 participants