@@ -2535,34 +2535,6 @@ class Typer extends Namer
2535
2535
}
2536
2536
}
2537
2537
2538
- /** If `tp` is a TypeVar which is fully constrained (i.e. its upper bound `hi` conforms
2539
- * to its lower bound `lo`), replace `tp` by `hi`. This is necessary to
2540
- * keep the right constraints for some implicit search problems. The paradigmatic case
2541
- * is `implicitNums.scala`. Without the healing done in `followAlias`, we cannot infer
2542
- * implicitly[_3], where _2 is the typelevel number 3. The problem here is that if a
2543
- * prototype is, say, Succ[Succ[Zero]], we can infer that it's argument type is Succ[Zero].
2544
- * But if the prototype is N? >: Succ[Succ[Zero]] <: Succ[Succ[Zero]], the same
2545
- * decomposition does not work - we'd get a N?#M where M is the element type name of Succ
2546
- * instead.
2547
- */
2548
- def followAlias (tp : Type )(implicit ctx : Context ): Type = {
2549
- val constraint = ctx.typerState.constraint
2550
- def inst (tp : Type ): Type = tp match {
2551
- case TypeBounds (lo, hi)
2552
- if (lo eq hi) || ctx.test(implicit ctx => hi <:< lo) =>
2553
- inst(lo)
2554
- case tp : TypeParamRef =>
2555
- constraint.typeVarOfParam(tp).orElse(tp)
2556
- case _ =>
2557
- NoType
2558
- }
2559
- tp match {
2560
- case tp : TypeVar if constraint.contains(tp) =>
2561
- inst(constraint.entry(tp.origin)).orElse(tp)
2562
- case _ => tp
2563
- }
2564
- }
2565
-
2566
2538
/** Reveal ignored parts of prototype when synthesizing the receiver
2567
2539
* of an extension method. This is necessary for pos/i5773a.scala
2568
2540
*/
@@ -2811,7 +2783,7 @@ class Typer extends Namer
2811
2783
}
2812
2784
2813
2785
def resultMatches (wtp : Type , pt : Type ) =
2814
- constrainResult(tree.symbol, wtp, revealProtoOfExtMethod(followAlias(pt) ))
2786
+ constrainResult(tree.symbol, wtp, revealProtoOfExtMethod(pt ))
2815
2787
2816
2788
def adaptNoArgs (wtp : Type ): Tree = {
2817
2789
val ptNorm = underlyingApplied(pt)
0 commit comments