@@ -3598,7 +3598,7 @@ object Types {
35983598 def underlying (implicit ctx : Context ): Type = bound
35993599
36003600 private [this ] var myReduced : Type = null
3601- private [this ] var reductionContext : mutable.Map [Type , TypeBounds ] = null
3601+ private [this ] var reductionContext : mutable.Map [Type , Type ] = null
36023602
36033603 override def tryNormalize (implicit ctx : Context ): Type = reduced.normalized
36043604
@@ -3634,38 +3634,41 @@ object Types {
36343634 }
36353635 }
36363636
3637- def isRelevant (tp : Type ) = tp match {
3638- case tp : TypeParamRef => ctx.typerState.constraint.entry(tp).exists
3637+ def isBounded (tp : Type ) = tp match {
3638+ case tp : TypeParamRef =>
36393639 case tp : TypeRef => ctx.gadt.bounds.contains(tp.symbol)
36403640 }
36413641
3642- def contextBounds (tp : Type ): TypeBounds = tp match {
3643- case tp : TypeParamRef => ctx.typerState.constraint.fullBounds(tp)
3644- case tp : TypeRef => ctx.gadt.bounds(tp.symbol)
3642+ def contextInfo (tp : Type ): Type = tp match {
3643+ case tp : TypeParamRef =>
3644+ val constraint = ctx.typerState.constraint
3645+ if (constraint.entry(tp).exists) constraint.fullBounds(tp)
3646+ else NoType
3647+ case tp : TypeRef =>
3648+ val bounds = ctx.gadt.bounds(tp.symbol)
3649+ if (bounds == null ) NoType else bounds
3650+ case tp : TypeVar =>
3651+ tp.underlying
36453652 }
36463653
36473654 def updateReductionContext () = {
36483655 reductionContext = new mutable.HashMap
3649- for (tp <- cmp.footprint if isRelevant(tp))
3650- reductionContext(tp) = contextBounds(tp)
3656+ for (tp <- cmp.footprint)
3657+ reductionContext(tp) = contextInfo(tp)
3658+ typr.println(i " footprint for $this $hashCode: ${cmp.footprint.toList.map(x => (x, contextInfo(x)))}%, % " )
36513659 }
36523660
36533661 def upToDate =
3654- cmp.footprint.forall { tp =>
3655- ! isRelevant(tp) || {
3656- reductionContext.get(tp) match {
3657- case Some (bounds) => bounds `eq` contextBounds(tp)
3658- case None => false
3659- }
3660- }
3662+ reductionContext.keysIterator.forall { tp =>
3663+ reductionContext(tp) `eq` contextInfo(tp)
36613664 }
36623665
36633666 record(" MatchType.reduce called" )
36643667 if (! Config .cacheMatchReduced || myReduced == null || ! upToDate) {
36653668 record(" MatchType.reduce computed" )
36663669 if (myReduced != null ) record(" MatchType.reduce cache miss" )
36673670 myReduced =
3668- trace(i " reduce match type $this" , typr, show = true ) {
3671+ trace(i " reduce match type $this $hashCode " , typr, show = true ) {
36693672 try
36703673 if (defn.isBottomType(scrutinee)) defn.NothingType
36713674 else if (reduceInParallel) reduceParallel(trackingCtx)
0 commit comments