Skip to content

Commit b53105f

Browse files
committed
Use putAttachment in exportForwarders to handle ambiguous overloads
exportForwarders can be called more than once for the same expression if there are ambiguous overloads. Closes #21071
1 parent aa931c4 commit b53105f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: compiler/src/dotty/tools/dotc/typer/Namer.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,11 @@ class Namer { typer: Typer =>
14521452
forwarders.derivedCons(forwarder2, avoidClashes(forwarders2))
14531453
case Nil => forwarders
14541454

1455-
addForwarders(selectors, Nil)
1456-
val forwarders = avoidClashes(buf.toList)
1457-
exp.putAttachment(ExportForwarders, forwarders)
1458-
forwarders
1455+
exp.getAttachment(ExportForwarders).getOrElse:
1456+
addForwarders(selectors, Nil)
1457+
val forwarders = avoidClashes(buf.toList)
1458+
exp.pushAttachment(ExportForwarders, forwarders)
1459+
forwarders
14591460
end exportForwarders
14601461

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

0 commit comments

Comments
 (0)