diff --git a/compiler/src/dotty/tools/dotc/report.scala b/compiler/src/dotty/tools/dotc/report.scala index 00b20b94ac87..8e39afdd6e7d 100644 --- a/compiler/src/dotty/tools/dotc/report.scala +++ b/compiler/src/dotty/tools/dotc/report.scala @@ -155,6 +155,7 @@ object report: | An unhandled exception was thrown in the compiler. | Please file a crash report here: | https://github.com/lampepfl/dotty/issues/new/choose + | For non-enriched exceptions, compile with -Yno-enrich-error-messages. | |$info1 |""".stripMargin diff --git a/compiler/src/dotty/tools/dotc/reporting/HideNonSensicalMessages.scala b/compiler/src/dotty/tools/dotc/reporting/HideNonSensicalMessages.scala index 5910d9b4d656..81e17c495d90 100644 --- a/compiler/src/dotty/tools/dotc/reporting/HideNonSensicalMessages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/HideNonSensicalMessages.scala @@ -13,8 +13,8 @@ trait HideNonSensicalMessages extends Reporter { */ override def isHidden(dia: Diagnostic)(using Context): Boolean = super.isHidden(dia) || { - dia.msg.isNonSensical && - hasErrors && // if there are no errors yet, report even if diagnostic is non-sensical - !ctx.settings.YshowSuppressedErrors.value + hasErrors // if there are no errors yet, report even if diagnostic is non-sensical + && dia.msg.isNonSensical // defer forcing the message by calling hasErrors first + && !ctx.settings.YshowSuppressedErrors.value } } diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index f567e094e831..ca4114a82cdc 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -155,8 +155,6 @@ abstract class Reporter extends interfaces.ReporterResult { addUnreported(key, 1) case _ => if !isHidden(dia) then // avoid isHidden test for summarized warnings so that message is not forced - markReported(dia) - withMode(Mode.Printing)(doReport(dia)) dia match { case w: Warning => warnings = w :: warnings @@ -169,6 +167,8 @@ abstract class Reporter extends interfaces.ReporterResult { case _: Info => // nothing to do here // match error if d is something else } + markReported(dia) + withMode(Mode.Printing)(doReport(dia)) end issueUnconfigured def issueIfNotSuppressed(dia: Diagnostic)(using Context): Unit =