@@ -34,10 +34,6 @@ object TypeTestsCasts {
3434 *
3535 * First do the following substitution:
3636 * (a) replace `T @unchecked` and pattern binder types (e.g., `_$1`) in P with WildcardType
37- * (b) replace pattern binder types (e.g., `_$1`) in X:
38- * - variance = 1 : hiBound
39- * - variance = -1 : loBound
40- * - variance = 0 : OrType(Any, Nothing) // TODO: use original type param bounds
4137 *
4238 * Then check:
4339 *
@@ -67,16 +63,6 @@ object TypeTestsCasts {
6763 }
6864 }.apply(tp)
6965
70- def replaceX (tp : Type )(using Context ) = new TypeMap {
71- def apply (tp : Type ) = tp match {
72- case tref : TypeRef if tref.typeSymbol.isPatternBound =>
73- if (variance == 1 ) tref.info.hiBound
74- else if (variance == - 1 ) tref.info.loBound
75- else OrType (defn.AnyType , defn.NothingType , soft = true ) // TODO: what does this line do?
76- case _ => mapOver(tp)
77- }
78- }.apply(tp)
79-
8066 /** Returns true if the type arguments of `P` can be determined from `X` */
8167 def typeArgsTrivial (X : Type , P : AppliedType )(using Context ) = inContext(ctx.fresh.setExploreTyperState().setFreshGADTBounds) {
8268 val AppliedType (tycon, _) = P
@@ -154,7 +140,7 @@ object TypeTestsCasts {
154140 case _ => true
155141 })
156142
157- val res = recur(replaceX( X .widen) , replaceP(P ))
143+ val res = recur(X .widen, replaceP(P ))
158144
159145 debug.println(i " checking ${X .show} isInstanceOf ${P } = $res" )
160146
0 commit comments