@@ -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
}
@@ -1837,7 +1838,7 @@ class Typer extends Namer
1837
1838
case Block (stats, expr) =>
1838
1839
tpd.cpy.Block (app)(stats, lift(expr))
1839
1840
}
1840
- Applications . wrapDefs(defs, lift(app))
1841
+ wrapDefs(defs, lift(app))
1841
1842
}
1842
1843
}
1843
1844
@@ -2640,7 +2641,9 @@ class Typer extends Namer
2640
2641
val app = tryExtension(nestedCtx)
2641
2642
if (! app.isEmpty && ! nestedCtx.reporter.hasErrors) {
2642
2643
nestedCtx.typerState.commit()
2643
- return Applications .ExtMethodApply (app).withType(app.tpe)
2644
+ return ExtMethodApply (app).withType(WildcardType )
2645
+ // Use wildcard type in order not to prompt any further adaptations such as eta expansion
2646
+ // before the method is fully applied.
2644
2647
}
2645
2648
case _ =>
2646
2649
}
@@ -2652,7 +2655,7 @@ class Typer extends Namer
2652
2655
else err.typeMismatch(tree, pt, failure)
2653
2656
if (ctx.mode.is(Mode .ImplicitsEnabled ) && tree.typeOpt.isValueType)
2654
2657
inferView(tree, pt) match {
2655
- case SearchSuccess (inferred : Applications . ExtMethodApply , _, _) =>
2658
+ case SearchSuccess (inferred : ExtMethodApply , _, _) =>
2656
2659
inferred // nothing to check or adapt for extension method applications
2657
2660
case SearchSuccess (inferred, _, _) =>
2658
2661
checkImplicitConversionUseOK(inferred.symbol, tree.pos)
@@ -2732,7 +2735,7 @@ class Typer extends Namer
2732
2735
adaptToArgs(wtp, pt)
2733
2736
case pt : PolyProto =>
2734
2737
tree match {
2735
- case _ : Applications . ExtMethodApply => tree
2738
+ case _ : ExtMethodApply => tree
2736
2739
case _ => tryInsertApplyOrImplicit(tree, pt, locked)(tree) // error will be reported in typedTypeApply
2737
2740
}
2738
2741
case _ =>
0 commit comments