Skip to content

Commit e7a1f7b

Browse files
committed
More explicit handling of exception in error reporting
1 parent cd313fb commit e7a1f7b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import java.io.{BufferedReader, PrintWriter}
1515
import scala.annotation.internal.sharable
1616
import scala.collection.mutable
1717
import core.Decorators.em
18+
import core.handleRecursive
1819

1920
object Reporter {
2021
/** Convert a SimpleReporter into a real Reporter */
@@ -155,7 +156,12 @@ abstract class Reporter extends interfaces.ReporterResult {
155156
addUnreported(key, 1)
156157
case _ =>
157158
if !isHidden(dia) then // avoid isHidden test for summarized warnings so that message is not forced
158-
withMode(Mode.Printing)(doReport(dia))
159+
try
160+
withMode(Mode.Printing)(doReport(dia))
161+
catch case ex: Throwable =>
162+
// #20158: Don't increment the error count, otherwise we might suppress
163+
// the RecursiveOverflow error and not print any error at all.
164+
handleRecursive("error reporting", dia.message, ex)
159165
dia match {
160166
case w: Warning =>
161167
warnings = w :: warnings

0 commit comments

Comments
 (0)