@@ -27,6 +27,7 @@ import EtaExpansion.etaExpand
2727import util .Positions ._
2828import util .common ._
2929import util .Property
30+ import Applications .{ExtMethodApply , wrapDefs , productSelectorTypes }
3031
3132import collection .mutable
3233import annotation .tailrec
@@ -426,7 +427,7 @@ class Typer extends Namer
426427
427428 def typeSelectOnTerm (implicit ctx : Context ): Tree =
428429 typedExpr(tree.qualifier, selectionProto(tree.name, pt, this )) match {
429- case qual1 @ Applications . ExtMethodApply (app) =>
430+ case qual1 @ ExtMethodApply (app) =>
430431 pt.revealIgnored match {
431432 case _ : PolyProto => qual1 // keep the ExtMethodApply to strip at next typedTypeApply
432433 case _ => app
@@ -926,7 +927,7 @@ class Typer extends Namer
926927 def ptIsCorrectProduct (formal : Type ) = {
927928 isFullyDefined(formal, ForceDegree .noBottom) &&
928929 (defn.isProductSubType(formal) || formal.derivesFrom(defn.PairClass )) &&
929- Applications . productSelectorTypes(formal).corresponds(params) {
930+ productSelectorTypes(formal).corresponds(params) {
930931 (argType, param) =>
931932 param.tpt.isEmpty || argType <:< typedAheadType(param.tpt).tpe
932933 }
@@ -1841,7 +1842,7 @@ class Typer extends Namer
18411842 case Block (stats, expr) =>
18421843 tpd.cpy.Block (app)(stats, lift(expr))
18431844 }
1844- Applications . wrapDefs(defs, lift(app))
1845+ wrapDefs(defs, lift(app))
18451846 }
18461847 }
18471848
@@ -2644,7 +2645,9 @@ class Typer extends Namer
26442645 val app = tryExtension(nestedCtx)
26452646 if (! app.isEmpty && ! nestedCtx.reporter.hasErrors) {
26462647 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.
26482651 }
26492652 case _ =>
26502653 }
@@ -2656,7 +2659,7 @@ class Typer extends Namer
26562659 else err.typeMismatch(tree, pt, failure)
26572660 if (ctx.mode.is(Mode .ImplicitsEnabled ) && tree.typeOpt.isValueType)
26582661 inferView(tree, pt) match {
2659- case SearchSuccess (inferred : Applications . ExtMethodApply , _, _) =>
2662+ case SearchSuccess (inferred : ExtMethodApply , _, _) =>
26602663 inferred // nothing to check or adapt for extension method applications
26612664 case SearchSuccess (inferred, _, _) =>
26622665 checkImplicitConversionUseOK(inferred.symbol, tree.pos)
@@ -2736,7 +2739,7 @@ class Typer extends Namer
27362739 adaptToArgs(wtp, pt)
27372740 case pt : PolyProto =>
27382741 tree match {
2739- case _ : Applications . ExtMethodApply => tree
2742+ case _ : ExtMethodApply => tree
27402743 case _ => tryInsertApplyOrImplicit(tree, pt, locked)(tree) // error will be reported in typedTypeApply
27412744 }
27422745 case _ =>
0 commit comments