Skip to content

Commit 149b433

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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ 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+
val maxc = maxConstraint.nn
19+
val maxcStr = try maxc.show catch case ex: StackOverflowError => maxc.toString
20+
printer.println(s"max constraint size: $maxSize")
21+
printer.println(s"max constraint = $maxcStr")
1922

2023
protected def reset(): Unit = maxConstraint = null
2124
}

0 commit comments

Comments
 (0)