Skip to content

Commit b765b95

Browse files
committed
Survive cyclic reference errors when printing an error message.
1 parent bcbd456 commit b765b95

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import dotty.tools.dotc.ast.Trees
2323
import dotty.tools.dotc.ast.untpd.Modifiers
2424
import dotty.tools.dotc.core.Flags.{FlagSet, Mutable}
2525
import dotty.tools.dotc.core.SymDenotations.SymDenotation
26+
import scala.util.control.NonFatal
2627

2728
object messages {
2829

@@ -708,10 +709,15 @@ object messages {
708709

709710
private val actualArgString = actual.map(_.show).mkString("[", ", ", "]")
710711

711-
private val prettyName = fntpe.termSymbol match {
712-
case NoSymbol => fntpe.show
713-
case symbol => symbol.showFullName
714-
}
712+
private val prettyName =
713+
try
714+
fntpe.termSymbol match {
715+
case NoSymbol => fntpe.show
716+
case symbol => symbol.showFullName
717+
}
718+
catch {
719+
case NonFatal(ex) => fntpe.show
720+
}
715721

716722
val msg =
717723
hl"""|${NoColor(msgPrefix)} type arguments for $prettyName$expectedArgString

0 commit comments

Comments
 (0)