@@ -466,16 +466,25 @@ class SpaceEngine(using Context) extends SpaceLogic {
466
466
467
467
tp match {
468
468
case tp @ AppliedType (tycon, args) =>
469
- if (tycon.isRef(defn.ArrayClass )) tp.derivedAppliedType(tycon, args.map(arg => erase(arg, inArray = true )))
470
- else tp.derivedAppliedType(tycon, args.map(arg => erase(arg, inArray = false )))
469
+ if tycon.typeSymbol.isPatternBound then return WildcardType
470
+
471
+ val args2 =
472
+ if (tycon.isRef(defn.ArrayClass )) args.map(arg => erase(arg, inArray = true ))
473
+ else args.map(arg => erase(arg, inArray = false ))
474
+ tp.derivedAppliedType(erase(tycon, inArray), args2)
475
+
471
476
case OrType (tp1, tp2) =>
472
477
OrType (erase(tp1, inArray), erase(tp2, inArray))
478
+
473
479
case AndType (tp1, tp2) =>
474
480
AndType (erase(tp1, inArray), erase(tp2, inArray))
481
+
475
482
case tp @ RefinedType (parent, _, _) =>
476
483
erase(parent)
484
+
477
485
case tref : TypeRef if tref.typeSymbol.isPatternBound =>
478
486
if (inArray) tref.underlying else WildcardType
487
+
479
488
case _ => tp
480
489
}
481
490
}
@@ -526,7 +535,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
526
535
val mt : MethodType = unapp.widen match {
527
536
case mt : MethodType => mt
528
537
case pt : PolyType =>
529
- inContext(ctx.fresh.setNewTyperState ()) {
538
+ inContext(ctx.fresh.setExploreTyperState ()) {
530
539
val tvars = pt.paramInfos.map(newTypeVar)
531
540
val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
532
541
scrutineeTp <:< mt.paramInfos(0 )
0 commit comments