Skip to content

Commit 55832b8

Browse files
committed
Fix docs and naming
1 parent c24ece5 commit 55832b8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/dotty/tools/dotc/config/Config.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ object Config {
1515
*/
1616
final val checkConstraintsNonCyclic = false
1717

18-
/** Like `checkConstraintsNonCyclic`, but all constrained parameters
19-
* are tested for direct or indirect dependencies, each time a
20-
* constraint is added in TypeComparer.
18+
/** Make sure none of the bounds in an OrderingConstraint contains
19+
* another constrained parameter at its toplevel (i.e. as an operand
20+
* of a combination of &'s and |'s.). The check is performed each time
21+
* a new bound is added to the constraint.
2122
*/
22-
final val checkConstraintsNonCyclicTrans = false
23+
final val checkConstraintsSeparated = false
2324

2425
/** Check that each constraint resulting from a subtype test
2526
* is satisfiable.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ trait ConstraintHandling {
4545
}
4646
}
4747
}
48-
if (Config.checkConstraintsNonCyclicTrans)
48+
if (Config.checkConstraintsSeparated)
4949
assert(!occursIn(bound), s"$param occurs in $bound")
5050
val c1 = constraint.narrowBound(param, bound, isUpper)
5151
(c1 eq constraint) || {
@@ -252,11 +252,13 @@ trait ConstraintHandling {
252252
* Some of the Ti are constrained parameters
253253
*
254254
* In each case we cannot record the relationship as an isLess, because
255-
* of he outer |/&. But we should not leave it in the constraint either
255+
* of the outer |/&. But we should not leave it in the constraint either
256256
* because that would risk making a parameter a subtype or supertype of a bound
257257
* where the parameter occurs again at toplevel, which leads to cycles
258258
* in the subtyping test. So we intentionally loosen the constraint in order
259259
* to keep it safe. A test case that demonstrates the problem is i864.scala.
260+
* Turn Config.checkConstraintsSeparated on to get an accurate diagnostic
261+
* of the cycle when it is created.
260262
*/
261263
def prune(bound: Type): Type = bound match {
262264
case bound: AndOrType =>

0 commit comments

Comments
 (0)