@@ -91,7 +91,7 @@ object TypeTestsCasts {
91
91
}.apply(tp)
92
92
93
93
/** Returns true if the type arguments of `P` can be determined from `X` */
94
- def typeArgsTrivial (X : Type , P : AppliedType )(implicit ctx : Context ) = {
94
+ def typeArgsTrivial (X : Type , P : AppliedType )(using Context ) = inContext(ctx.fresh.setExploreTyperState().setFreshGADTBounds) {
95
95
val AppliedType (tycon, _) = P
96
96
97
97
def underlyingLambda (tp : Type ): TypeLambda = tp.ensureLambdaSub match {
@@ -146,10 +146,11 @@ object TypeTestsCasts {
146
146
recur(tp1, P ) && recur(tp2, P )
147
147
case _ =>
148
148
// always false test warnings are emitted elsewhere
149
- X .classSymbol.exists && P .classSymbol.exists && ! X .classSymbol.asClass.mayHaveCommonChild(P .classSymbol.asClass) ||
149
+ X .classSymbol.exists && P .classSymbol.exists &&
150
+ ! X .classSymbol.asClass.mayHaveCommonChild(P .classSymbol.asClass) ||
150
151
// first try without striping type parameters for performance
151
- typeArgsTrivial(X , tpe)(ctx.fresh.setNewTyperState().setFreshGADTBounds) ||
152
- typeArgsTrivial(stripTypeParam(X ), tpe)(ctx.fresh.setNewTyperState().setFreshGADTBounds)
152
+ typeArgsTrivial(X , tpe) ||
153
+ typeArgsTrivial(stripTypeParam(X ), tpe)
153
154
}
154
155
case AndType (tp1, tp2) => recur(X , tp1) && recur(X , tp2)
155
156
case OrType (tp1, tp2) => recur(X , tp1) && recur(X , tp2)
0 commit comments