Skip to content

Commit 2662e6f

Browse files
committed
Prevent adaptations of extension method applications
Prevent adaptations of extension method applications coming from implicit search. We already did the same for extension method applications coming from imports.
1 parent dc62333 commit 2662e6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,10 @@ trait Implicits { self: Typer =>
13481348
}
13491349
else {
13501350
val returned =
1351-
if (cand.isExtension) new Applications.ExtMethodApply(adapted).withType(adapted.tpe)
1351+
if (cand.isExtension)
1352+
new Applications.ExtMethodApply(adapted).withType(WildcardType)
1353+
// Use wildcard type in order not to prompt any further adaptations such as eta expansion
1354+
// before the method is fully applied.
13521355
else adapted
13531356
SearchSuccess(returned, ref, cand.level)(ctx.typerState, ctx.gadt)
13541357
}

0 commit comments

Comments
 (0)