Skip to content
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

Fix erased context function types, 2nd attempt #13736

Merged
merged 4 commits into from Nov 10, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 12, 2021

  1. Name mangle methods with erased context results

Add a $ to the name of a method that has erased context results and that
may override some other method. This is to prevent the two methods from having
the same names and parameters in their erased signatures. We need a bridge between the
two methods, so they are not allowed to already override after erasure.

  1. Change the logic of eta expansion at erasure to take erased functions into account.

@nicolasstucki
Copy link
Contributor

Otherwise LGTM

def erasedName =
if ref.is(Flags.Method)
&& contextResultsAreErased(ref.symbol)
&& (ref.owner.is(Flags.Trait) || ref.symbol.allOverriddenSymbols.hasNext)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from breaking binary compatibility is there another reason not to name all contex function dirrect accessors with $direct? It seems that nameing all these methods with $direct would also solve some of the other overloading issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name mangling is always bad because it confuses tack traces and (in this case) causes more indirection via bridge methods, which blows up code sizes. So I'd avoid it if we don't absolutely need it.

Add a `$` to the name of a method that has erased context results and that
may override some other method. This is to prevent the two methods from having
the same names and parameters in their erased signatures. We need a bridge between the
two methods, so they are not allowed to already override after erasure.
Use "$direct" instead of just "$" to prevent erasure clashes of methods
with erased context function results.
@odersky odersky merged commit f836589 into scala:master Nov 10, 2021
@odersky odersky deleted the fix-13691-v2 branch November 10, 2021 11:25
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 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.

None yet

3 participants