File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ import config.Printers.{ transforms => debug }
2626 */
2727object TypeTestsCasts {
2828 import ast .tpd ._
29- import typer .Inferencing .maximizeType
30- import typer .ProtoTypes .constrained
29+ import typer ._
30+ import typer .Inferencing ._
31+ import typer .ProtoTypes ._
3132
3233 /** Whether `(x:X).isInstanceOf[P]` can be checked at runtime?
3334 *
@@ -77,14 +78,12 @@ object TypeTestsCasts {
7778
7879 /** Approximate type parameters depending on variance */
7980 def stripTypeParam (tp : Type )(using Context ) = new ApproximatingTypeMap {
81+ val boundTypeParams = util.HashMap [TypeRef , TypeVar ]()
8082 def apply (tp : Type ): Type = tp match {
8183 case _ : MatchType =>
8284 tp // break cycles
8385 case tp : TypeRef if isBounds(tp.underlying) =>
84- def lo = apply(tp.info.loBound.subst(tp.symbol :: Nil , WildcardType :: Nil ))
85- def hi = apply(tp.info.hiBound.subst(tp.symbol :: Nil , WildcardType :: Nil ))
86-
87- range(lo, hi)
86+ boundTypeParams.getOrElseUpdate(tp, newTypeVar(tp.underlying.toBounds))
8887 case _ =>
8988 mapOver(tp)
9089 }
@@ -127,6 +126,7 @@ object TypeTestsCasts {
127126 debug.println(" P1 <:< P = " + res)
128127
129128 res
129+
130130 }
131131
132132 def recur (X : Type , P : Type ): Boolean = (X <:< P ) || (P .dealias match {
You can’t perform that action at this time.
0 commit comments