Skip to content

Conversation

@wjoel
Copy link
Contributor

@wjoel wjoel commented Aug 30, 2024

exportForwarders can be called more than once for the same expression if there are ambiguous overloads.

Closes #21071

addForwarders(selectors, Nil)
val forwarders = avoidClashes(buf.toList)
exp.pushAttachment(ExportForwarders, forwarders)
exp.putAttachment(ExportForwarders, forwarders)
Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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
@wjoel wjoel changed the title Use putAttachment in exportForwarders to handle ambiguous overloads Re-use attachment in exportForwarders to handle ambiguous overloads Sep 3, 2024
@sjrd sjrd enabled auto-merge September 3, 2024 15:42
@sjrd sjrd merged commit 21a3d39 into scala:main Sep 3, 2024
@wjoel wjoel deleted the fix-21071 branch September 3, 2024 18:41
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
WojciechMazur added a commit that referenced this pull request Dec 4, 2024
…verloads" to LTS (#22116)

Backports #21518 to the 3.3.5.

PR submitted by the release tooling.
[skip ci]
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.

Export statement + ambiguous overload crash compiler

3 participants