@@ -466,16 +466,25 @@ class SpaceEngine(using Context) extends SpaceLogic {
466466
467467 tp match {
468468 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+
471476 case OrType (tp1, tp2) =>
472477 OrType (erase(tp1, inArray), erase(tp2, inArray))
478+
473479 case AndType (tp1, tp2) =>
474480 AndType (erase(tp1, inArray), erase(tp2, inArray))
481+
475482 case tp @ RefinedType (parent, _, _) =>
476483 erase(parent)
484+
477485 case tref : TypeRef if tref.typeSymbol.isPatternBound =>
478486 if (inArray) tref.underlying else WildcardType
487+
479488 case _ => tp
480489 }
481490 }
@@ -526,7 +535,7 @@ class SpaceEngine(using Context) extends SpaceLogic {
526535 val mt : MethodType = unapp.widen match {
527536 case mt : MethodType => mt
528537 case pt : PolyType =>
529- inContext(ctx.fresh.setNewTyperState ()) {
538+ inContext(ctx.fresh.setExploreTyperState ()) {
530539 val tvars = pt.paramInfos.map(newTypeVar)
531540 val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
532541 scrutineeTp <:< mt.paramInfos(0 )
0 commit comments