@@ -3583,28 +3583,36 @@ object Types {
35833583 else recur(cases1)
35843584 }
35853585
3586+ def isRelevant (tp : Type ) = tp match {
3587+ case tp : TypeParamRef => ctx.typerState.constraint.entry(tp).exists
3588+ case tp : TypeRef => ctx.gadt.bounds.contains(tp.symbol)
3589+ }
3590+
35863591 def contextBounds (tp : Type ): TypeBounds = tp match {
3587- case tp : TypeParamRef =>
3588- if (ctx.typerState.constraint.entry(tp).exists)
3589- ctx.typerState.constraint.fullBounds(tp)
3590- else TypeBounds .empty
3592+ case tp : TypeParamRef => ctx.typerState.constraint.fullBounds(tp)
35913593 case tp : TypeRef => ctx.gadt.bounds(tp.symbol)
35923594 }
35933595
35943596 def updateReductionContext () = {
35953597 reductionContext = new mutable.HashMap
3596- for (tp <- cmp.footprint) reductionContext(tp) = contextBounds(tp)
3598+ for (tp <- cmp.footprint if isRelevant(tp))
3599+ reductionContext(tp) = contextBounds(tp)
35973600 }
35983601
35993602 def upToDate =
36003603 cmp.footprint.forall { tp =>
3601- reductionContext.get(tp) match {
3602- case Some (bounds) => bounds `eq` contextBounds(tp)
3603- case None => false
3604+ ! isRelevant(tp) || {
3605+ reductionContext.get(tp) match {
3606+ case Some (bounds) => bounds `eq` contextBounds(tp)
3607+ case None => false
3608+ }
36043609 }
36053610 }
36063611
3612+ record(" MatchType.reduce called" )
36073613 if (! Config .cacheMatchReduced || myReduced == null || ! upToDate) {
3614+ record(" MatchType.reduce computed" )
3615+ if (myReduced != null ) record(" MatchType.reduce cache miss" )
36083616 myReduced = recur(cases)(trackingCtx)
36093617 updateReductionContext()
36103618 }
0 commit comments