@@ -104,6 +104,18 @@ object OrderingConstraint {
104
104
def updateEntries (c : OrderingConstraint , poly : TypeLambda , entries : Array [Type ])(using Context ): OrderingConstraint =
105
105
c.newConstraint(boundsMap = c.boundsMap.updated(poly, entries))
106
106
def initial = NoType
107
+
108
+ override def update (prev : OrderingConstraint , current : OrderingConstraint ,
109
+ poly : TypeLambda , idx : Int , entry : Type )(using Context ): OrderingConstraint =
110
+ entry match
111
+ case TypeBounds (lo, hi) if lo eq hi =>
112
+ val replaceParams = new TypeMap :
113
+ def apply (tp : Type ): Type = tp match
114
+ case tp : TypeParamRef => current.typeVarOfParam(tp)
115
+ case _ => mapOver(tp)
116
+ super .update(prev, current, poly, idx, replaceParams(hi))
117
+ case _ =>
118
+ super .update(prev, current, poly, idx, entry)
107
119
}
108
120
109
121
private val lowerLens : ConstraintLens [List [TypeParamRef ]] = new ConstraintLens [List [TypeParamRef ]] {
@@ -483,7 +495,10 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
483
495
case param : TypeParamRef if contains(param) =>
484
496
todos += (if isUpper then order(_, _, param) else order(_, param, _))
485
497
NoType
486
- case tp : TypeBounds =>
498
+ case tp : TypeBounds if tp.lo ne tp.hi =>
499
+ // IMPROVE
500
+ // - pass current ? or
501
+ // - do opt in add too
487
502
val lo1 = stripParams(tp.lo, todos, ! isUpper).orElse(defn.NothingType )
488
503
val hi1 = stripParams(tp.hi, todos, isUpper).orElse(tp.topType)
489
504
tp.derivedTypeBounds(lo1, hi1)
0 commit comments