Skip to content

Commit bd8b5bb

Browse files
committed
Disable checkConstraintClosed by default
Checking that constraints are closed caused cyclic reference exceptions in DottyBackedInterface. What's worrying is that these were seemingly not checked by the checkin tests. Or maybe there is some dependcy on compilation order that triggers the erros only in my setup.
1 parent 6922288 commit bd8b5bb

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ object Config {
3232
*/
3333
final val checkConstraintsPropagated = false
3434

35-
/** Check that constraints of globally committable typer states are closed */
36-
final val checkConstraintsClosed = true
35+
/** Check that constraints of globally committable typer states are closed.
36+
* NOTE: When enabled, the check can cause CyclicReference errors because
37+
* it traverses all elements of a type. Such failures were observed when
38+
* compiling all of dotty together (source seems to be in GenBCode which
39+
* accesses javac's settings.)
40+
*
41+
* It is recommended to turn this option on only when chasing down
42+
* a PolyParam instantiation error. See comment in Types.TypeVar.instantiate.
43+
*/
44+
final val debugCheckConstraintsClosed = false
3745

3846
/** Check that no type appearing as the info of a SymDenotation contains
3947
* skolem types.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extends TyperState(r) {
8787

8888
override def constraint = myConstraint
8989
override def constraint_=(c: Constraint)(implicit ctx: Context) = {
90-
if (Config.checkConstraintsClosed && isGlobalCommittable) c.checkClosed()
90+
if (Config.debugCheckConstraintsClosed && isGlobalCommittable) c.checkClosed()
9191
myConstraint = c
9292
}
9393

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,6 +2460,8 @@ object Types {
24602460

24612461
if (ctx.typerState.isGlobalCommittable)
24622462
assert(!inst.isInstanceOf[PolyParam], i"bad inst $this := $inst, constr = ${ctx.typerState.constraint}")
2463+
// If this fails, you might want to turn on Config.debugCheckConstraintsClosed
2464+
// to help find the root of the problem.
24632465

24642466
instantiateWith(inst)
24652467
}

0 commit comments

Comments
 (0)