-
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
Re-use attachment in exportForwarders to handle ambiguous overloads #21518
Conversation
@@ -1454,7 +1454,7 @@ class Namer { typer: Typer => | |||
|
|||
addForwarders(selectors, Nil) | |||
val forwarders = avoidClashes(buf.toList) | |||
exp.pushAttachment(ExportForwarders, forwarders) | |||
exp.putAttachment(ExportForwarders, forwarders) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, it doesn't (at a glance) seem like this will ever give a different result, so maybe this is better?
exp.getAttachment(ExportForwarders).getOrElse:
addForwarders(selectors, Nil)
val forwarders = avoidClashes(buf.toList)
exp.putAttachment(ExportForwarders, forwarders)
forwarders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's try that alternative. It seems better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, PR updated.
exportForwarders can be called more than once for the same expression if there are ambiguous overloads. Just return the already computed ExportForwarders if that happens. Closes scala#21071
exportForwarders can be called more than once for the same expression if there are ambiguous overloads.
Closes #21071