@@ -27,6 +27,7 @@ import EtaExpansion.etaExpand
27
27
import util .Positions ._
28
28
import util .common ._
29
29
import util .Property
30
+ import Applications .{ExtMethodApply , wrapDefs , productSelectorTypes }
30
31
31
32
import collection .mutable
32
33
import annotation .tailrec
@@ -426,7 +427,7 @@ class Typer extends Namer
426
427
427
428
def typeSelectOnTerm (implicit ctx : Context ): Tree =
428
429
typedExpr(tree.qualifier, selectionProto(tree.name, pt, this )) match {
429
- case qual1 @ Applications . ExtMethodApply (app) =>
430
+ case qual1 @ ExtMethodApply (app) =>
430
431
pt.revealIgnored match {
431
432
case _ : PolyProto => qual1 // keep the ExtMethodApply to strip at next typedTypeApply
432
433
case _ => app
@@ -926,7 +927,7 @@ class Typer extends Namer
926
927
def ptIsCorrectProduct (formal : Type ) = {
927
928
isFullyDefined(formal, ForceDegree .noBottom) &&
928
929
(defn.isProductSubType(formal) || formal.derivesFrom(defn.PairClass )) &&
929
- Applications . productSelectorTypes(formal).corresponds(params) {
930
+ productSelectorTypes(formal).corresponds(params) {
930
931
(argType, param) =>
931
932
param.tpt.isEmpty || argType <:< typedAheadType(param.tpt).tpe
932
933
}
@@ -1841,7 +1842,7 @@ class Typer extends Namer
1841
1842
case Block (stats, expr) =>
1842
1843
tpd.cpy.Block (app)(stats, lift(expr))
1843
1844
}
1844
- Applications . wrapDefs(defs, lift(app))
1845
+ wrapDefs(defs, lift(app))
1845
1846
}
1846
1847
}
1847
1848
@@ -2644,7 +2645,9 @@ class Typer extends Namer
2644
2645
val app = tryExtension(nestedCtx)
2645
2646
if (! app.isEmpty && ! nestedCtx.reporter.hasErrors) {
2646
2647
nestedCtx.typerState.commit()
2647
- return Applications .ExtMethodApply (app).withType(app.tpe)
2648
+ return ExtMethodApply (app).withType(WildcardType )
2649
+ // Use wildcard type in order not to prompt any further adaptations such as eta expansion
2650
+ // before the method is fully applied.
2648
2651
}
2649
2652
case _ =>
2650
2653
}
@@ -2656,7 +2659,7 @@ class Typer extends Namer
2656
2659
else err.typeMismatch(tree, pt, failure)
2657
2660
if (ctx.mode.is(Mode .ImplicitsEnabled ) && tree.typeOpt.isValueType)
2658
2661
inferView(tree, pt) match {
2659
- case SearchSuccess (inferred : Applications . ExtMethodApply , _, _) =>
2662
+ case SearchSuccess (inferred : ExtMethodApply , _, _) =>
2660
2663
inferred // nothing to check or adapt for extension method applications
2661
2664
case SearchSuccess (inferred, _, _) =>
2662
2665
checkImplicitConversionUseOK(inferred.symbol, tree.pos)
@@ -2736,7 +2739,7 @@ class Typer extends Namer
2736
2739
adaptToArgs(wtp, pt)
2737
2740
case pt : PolyProto =>
2738
2741
tree match {
2739
- case _ : Applications . ExtMethodApply => tree
2742
+ case _ : ExtMethodApply => tree
2740
2743
case _ => tryInsertApplyOrImplicit(tree, pt, locked)(tree) // error will be reported in typedTypeApply
2741
2744
}
2742
2745
case _ =>
0 commit comments