Skip to content

Fix cyclic reference errors in collection strawman #2914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 2, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import dotty.tools.dotc.ast.Trees
import dotty.tools.dotc.ast.untpd.Modifiers
import dotty.tools.dotc.core.Flags.{FlagSet, Mutable}
import dotty.tools.dotc.core.SymDenotations.SymDenotation
import scala.util.control.NonFatal

object messages {

Expand Down Expand Up @@ -708,10 +709,15 @@ object messages {

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

private val prettyName = fntpe.termSymbol match {
case NoSymbol => fntpe.show
case symbol => symbol.showFullName
}
private val prettyName =
try
fntpe.termSymbol match {
case NoSymbol => fntpe.show
case symbol => symbol.showFullName
}
catch {
case NonFatal(ex) => fntpe.show
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is only for cyclic references, could we do case ex: CyclicReference instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we by default we should not throw any exception from printing. It detracts from the underlying cause.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but we shouldn't be throwing any kind of exceptions, and silently catching them all might hide issues.

}

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