diff --git a/compiler/src/dotty/tools/dotc/core/TyperState.scala b/compiler/src/dotty/tools/dotc/core/TyperState.scala index 8a07981f1be7..f18ea23ed760 100644 --- a/compiler/src/dotty/tools/dotc/core/TyperState.scala +++ b/compiler/src/dotty/tools/dotc/core/TyperState.scala @@ -232,11 +232,12 @@ class TyperState() { tvars.foreach(tvar => if !tvar.inst.exists then if !isOwnedAnywhere(this, tvar) then includeVar(tvar) - if constraint.isHard(tvar) then constraint = constraint.withHard(tvar)) typeComparer.addToConstraint(tl, tvars) }) && // Integrate the additional constraints on type variables from `other` + // and merge hardness markers constraint.uninstVars.forall(tv => + if other.isHard(tv) then constraint = constraint.withHard(tv) val p = tv.origin val otherLos = other.lower(p) val otherHis = other.upper(p)