aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/config/Config.scala6
-rw-r--r--src/dotty/tools/dotc/core/ConstraintHandling.scala4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/config/Config.scala b/src/dotty/tools/dotc/config/Config.scala
index 81c1af5c9..db0c3ce4a 100644
--- a/src/dotty/tools/dotc/config/Config.scala
+++ b/src/dotty/tools/dotc/config/Config.scala
@@ -26,6 +26,12 @@ object Config {
*/
final val checkConstraintsSatisfiable = false
+ /** Check that each constraint is fully propagated. i.e.
+ * If P <: Q then the upper bound of P is a subtype of the upper bound of Q
+ * and the lower bound of Q is a subtype of the lower bound of P.
+ */
+ final val checkConstraintsPropagated = false
+
/** Type comparer will fail with an assert if the upper bound
* of a constrained parameter becomes Nothing. This should be turned
* on only for specific debugging as normally instantiation to Nothing
diff --git a/src/dotty/tools/dotc/core/ConstraintHandling.scala b/src/dotty/tools/dotc/core/ConstraintHandling.scala
index e79dc28b9..28a0c87a2 100644
--- a/src/dotty/tools/dotc/core/ConstraintHandling.scala
+++ b/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -236,7 +236,7 @@ trait ConstraintHandling {
*/
protected def addConstraint(param: PolyParam, bound: Type, fromBelow: Boolean): Boolean = {
def description = i"constr $param ${if (fromBelow) ">:" else "<:"} $bound:\n$constraint"
- checkPropagated(s"adding $description")(true)
+ //checkPropagated(s"adding $description")(true) // DEBUG in case following fails
checkPropagated(s"added $description") {
addConstraintInvocations += 1
try bound match {
@@ -250,7 +250,7 @@ trait ConstraintHandling {
}
def checkPropagated(msg: => String)(result: Boolean): Boolean = {
- if (result && addConstraintInvocations == 0) {
+ if (Config.checkConstraintsPropagated && result && addConstraintInvocations == 0) {
frozenConstraint = true
for (p <- constraint.domainParams) {
for (u <- constraint.upper(p))