@@ -594,6 +594,8 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
594
594
val replacement = tp.dealiasKeepAnnots.stripTypeVar
595
595
if param == replacement then this .checkWellFormed()
596
596
else
597
+ assert(replacement.isValueTypeOrLambda)
598
+
597
599
val droppedTypeVar = typeVarOfParam(param)
598
600
// println(i"replace $param, $droppedTypeVar with $replacement in $this")
599
601
val substParamAndDropTypeVar = new SubstParamMap (param, replacement):
@@ -603,13 +605,9 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
603
605
replacement
604
606
else super .apply(t)
605
607
606
- assert(replacement.isValueTypeOrLambda)
607
- var current =
608
- if isRemovable(param.binder) then remove(param.binder)
609
- else updateEntry(this , param, replacement)
608
+ var current = this
610
609
611
610
def removeParam (ps : List [TypeParamRef ]) = ps.filterConserve(param ne _)
612
-
613
611
for lo <- lower(param) do
614
612
current = upperLens.map(this , current, lo, removeParam)
615
613
for hi <- upper(param) do
@@ -621,6 +619,10 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
621
619
val newEntry = current.ensureNonCyclic(other, substParamAndDropTypeVar(oldEntry))
622
620
current = updateEntryNoOrdering(current, other, newEntry, oldEntry)
623
621
}
622
+
623
+ current =
624
+ if isRemovable(param.binder) then current.remove(param.binder)
625
+ else updateEntry(current, param, replacement)
624
626
current.dropDeps(param)
625
627
current.checkWellFormed()
626
628
end replace
0 commit comments