@@ -2494,13 +2494,6 @@ class Typer extends Namer
2494
2494
}
2495
2495
}
2496
2496
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
-
2504
2497
def adaptNoArgsImplicitMethod (wtp : MethodType ): Tree = {
2505
2498
assert(wtp.isImplicitMethod)
2506
2499
val tvarsToInstantiate = tvarsInParams(tree, locked).distinct
@@ -2521,7 +2514,7 @@ class Typer extends Namer
2521
2514
arg.tpe match {
2522
2515
case failed : AmbiguousImplicits =>
2523
2516
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)
2525
2518
else arg :: implicitArgs(formals1, argIndex + 1 , pt1)
2526
2519
case failed : SearchFailureType if ! tree.symbol.hasDefaultParams =>
2527
2520
// no need to search further, the adapt fails in any case
@@ -2754,9 +2747,6 @@ class Typer extends Namer
2754
2747
case _ => tp
2755
2748
}
2756
2749
2757
- def resultMatches (wtp : Type , pt : Type ) =
2758
- constrainResult(tree.symbol, wtp, revealProtoOfExtMethod(pt))
2759
-
2760
2750
def adaptNoArgs (wtp : Type ): Tree = {
2761
2751
val ptNorm = underlyingApplied(pt)
2762
2752
def functionExpected = defn.isFunctionType(ptNorm)
@@ -2770,7 +2760,7 @@ class Typer extends Namer
2770
2760
case wtp : ExprType =>
2771
2761
readaptSimplified(tree.withType(wtp.resultType))
2772
2762
case wtp : MethodType if wtp.isImplicitMethod &&
2773
- ({ resMatch = resultMatches( wtp, pt); resMatch } || ! functionExpected) =>
2763
+ ({ resMatch = constrainResult(tree.symbol, wtp, pt); resMatch } || ! functionExpected) =>
2774
2764
if (resMatch || ctx.mode.is(Mode .ImplicitsEnabled ))
2775
2765
adaptNoArgsImplicitMethod(wtp)
2776
2766
else {
0 commit comments