@@ -2494,13 +2494,6 @@ class Typer extends Namer
24942494 }
24952495 }
24962496
2497- /** Reveal ignored parts of prototype when synthesizing the receiver
2498- * of an extension method. This is necessary for pos/i5773a.scala
2499- */
2500- def revealProtoOfExtMethod (tp : Type )(implicit ctx : Context ): Type =
2501- if (ctx.mode.is(Mode .SynthesizeExtMethodReceiver )) tp.deepenProto
2502- else tp
2503-
25042497 def adaptNoArgsImplicitMethod (wtp : MethodType ): Tree = {
25052498 assert(wtp.isImplicitMethod)
25062499 val tvarsToInstantiate = tvarsInParams(tree, locked).distinct
@@ -2521,7 +2514,7 @@ class Typer extends Namer
25212514 arg.tpe match {
25222515 case failed : AmbiguousImplicits =>
25232516 val pt1 = pt.deepenProto
2524- if ((pt1 `ne` pt) && resultMatches( wtp, pt1)) implicitArgs(formals, argIndex, pt1)
2517+ if ((pt1 `ne` pt) && constrainResult(tree.symbol, wtp, pt1)) implicitArgs(formals, argIndex, pt1)
25252518 else arg :: implicitArgs(formals1, argIndex + 1 , pt1)
25262519 case failed : SearchFailureType if ! tree.symbol.hasDefaultParams =>
25272520 // no need to search further, the adapt fails in any case
@@ -2754,9 +2747,6 @@ class Typer extends Namer
27542747 case _ => tp
27552748 }
27562749
2757- def resultMatches (wtp : Type , pt : Type ) =
2758- constrainResult(tree.symbol, wtp, revealProtoOfExtMethod(pt))
2759-
27602750 def adaptNoArgs (wtp : Type ): Tree = {
27612751 val ptNorm = underlyingApplied(pt)
27622752 def functionExpected = defn.isFunctionType(ptNorm)
@@ -2770,7 +2760,7 @@ class Typer extends Namer
27702760 case wtp : ExprType =>
27712761 readaptSimplified(tree.withType(wtp.resultType))
27722762 case wtp : MethodType if wtp.isImplicitMethod &&
2773- ({ resMatch = resultMatches( wtp, pt); resMatch } || ! functionExpected) =>
2763+ ({ resMatch = constrainResult(tree.symbol, wtp, pt); resMatch } || ! functionExpected) =>
27742764 if (resMatch || ctx.mode.is(Mode .ImplicitsEnabled ))
27752765 adaptNoArgsImplicitMethod(wtp)
27762766 else {
0 commit comments