From 7f47867a824f3fd38aed63eaedfa4f4d339cbd99 Mon Sep 17 00:00:00 2001 From: Kacper Korban Date: Tue, 5 Nov 2024 22:18:15 +0100 Subject: [PATCH] Don't point to the compiler backlog when a compiler plugin phase crashes (#21887) closes #21783 --- compiler/src/dotty/tools/dotc/report.scala | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/report.scala b/compiler/src/dotty/tools/dotc/report.scala index e24e6be38b2b..2ccf918e12fa 100644 --- a/compiler/src/dotty/tools/dotc/report.scala +++ b/compiler/src/dotty/tools/dotc/report.scala @@ -165,13 +165,23 @@ object report: "compiler version" -> dotty.tools.dotc.config.Properties.versionString, "settings" -> settings.map(showSetting).mkString(" "), )) + val fileAReportMsg = + if ctx.phase.isInstanceOf[plugins.PluginPhase] + then + s"""| An unhandled exception was thrown in the compiler plugin named "${ctx.phase.megaPhase}". + | Please report the issue to the plugin's maintainers. + | For non-enriched exceptions, compile with -Xno-enrich-error-messages. + |""".stripMargin + else + s"""| An unhandled exception was thrown in the compiler. + | Please file a crash report here: + | https://github.com/scala/scala3/issues/new/choose + | For non-enriched exceptions, compile with -Xno-enrich-error-messages. + |""".stripMargin s""" | $errorMessage | - | An unhandled exception was thrown in the compiler. - | Please file a crash report here: - | https://github.com/scala/scala3/issues/new/choose - | For non-enriched exceptions, compile with -Xno-enrich-error-messages. + |$fileAReportMsg | |$info1 |""".stripMargin