@@ -3583,28 +3583,36 @@ object Types {
3583
3583
else recur(cases1)
3584
3584
}
3585
3585
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
+
3586
3591
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)
3591
3593
case tp : TypeRef => ctx.gadt.bounds(tp.symbol)
3592
3594
}
3593
3595
3594
3596
def updateReductionContext () = {
3595
3597
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)
3597
3600
}
3598
3601
3599
3602
def upToDate =
3600
3603
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
+ }
3604
3609
}
3605
3610
}
3606
3611
3612
+ record(" MatchType.reduce called" )
3607
3613
if (! Config .cacheMatchReduced || myReduced == null || ! upToDate) {
3614
+ record(" MatchType.reduce computed" )
3615
+ if (myReduced != null ) record(" MatchType.reduce cache miss" )
3608
3616
myReduced = recur(cases)(trackingCtx)
3609
3617
updateReductionContext()
3610
3618
}
0 commit comments