Skip to content

Commit

Permalink
Use putAttachment in exportForwarders to handle ambiguous overloads
Browse files Browse the repository at this point in the history
exportForwarders can be called more than once for the same expression
if there are ambiguous overloads.

Closes #21071
  • Loading branch information
wjoel committed Sep 3, 2024
1 parent aa931c4 commit b53105f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1452,10 +1452,11 @@ class Namer { typer: Typer =>
forwarders.derivedCons(forwarder2, avoidClashes(forwarders2))
case Nil => forwarders

addForwarders(selectors, Nil)
val forwarders = avoidClashes(buf.toList)
exp.putAttachment(ExportForwarders, forwarders)
forwarders
exp.getAttachment(ExportForwarders).getOrElse:
addForwarders(selectors, Nil)
val forwarders = avoidClashes(buf.toList)
exp.pushAttachment(ExportForwarders, forwarders)
forwarders
end exportForwarders

/** Add forwarders as required by the export statements in this class */
Expand Down

0 comments on commit b53105f

Please sign in to comment.