Skip to content

Commit 38c8c53

Browse files
committed
Switch to new hk scheme.
1 parent cbf213f commit 38c8c53

File tree

9 files changed

+309
-251
lines changed

9 files changed

+309
-251
lines changed

src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ trait ConstraintHandling {
232232
}
233233
}
234234

235+
/** Instantiate `param` to `tp` if the constraint stays satisfiable */
236+
protected def tryInstantiate(param: PolyParam, tp: Type): Boolean = {
237+
val saved = constraint
238+
constraint =
239+
if (addConstraint(param, tp, fromBelow = true) &&
240+
addConstraint(param, tp, fromBelow = false)) constraint.replace(param, tp)
241+
else saved
242+
constraint ne saved
243+
}
244+
235245
/** Check that constraint is fully propagated. See comment in Config.checkConstraintsPropagated */
236246
def checkPropagated(msg: => String)(result: Boolean): Boolean = {
237247
if (Config.checkConstraintsPropagated && result && addConstraintInvocations == 0) {

0 commit comments

Comments
 (0)