Skip to content

Commit 5c16d2c

Browse files
committed
Handle stackoverflows when trying to print the maximal constraint
1 parent ef3dacf commit 5c16d2c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintRunInfo.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ trait ConstraintRunInfo { self: Run =>
1313
maxConstraint = c
1414
}
1515
def printMaxConstraint()(using Context): Unit =
16-
val printer = if (ctx.settings.YdetailedStats.value) default else typr
1716
if maxSize > 0 then
18-
printer.println(s"max constraint = ${maxConstraint.nn.show}\nsize = $maxSize")
17+
val printer = if ctx.settings.YdetailedStats.value then default else typr
18+
printer.println(s"max constraint size: $maxSize")
19+
try printer.println(s"max constraint = ${maxConstraint.nn.show}")
20+
catch case ex: StackOverflowError => printer.println("max constraint cannot be printed due to stack overflow")
1921

2022
protected def reset(): Unit = maxConstraint = null
2123
}

0 commit comments

Comments
 (0)