aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/printing
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-11 15:05:59 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-11 15:06:42 +0100
commit76fec95265161246471932757a25ab54ea4ee393 (patch)
tree1dcae2410e7f5b57878a6600108444aaf34c3c57 /src/dotty/tools/dotc/printing
parent561e2e864daa2cd017aa938a73739e5af6c4c306 (diff)
downloaddotty-76fec95265161246471932757a25ab54ea4ee393.tar.gz
dotty-76fec95265161246471932757a25ab54ea4ee393.tar.bz2
dotty-76fec95265161246471932757a25ab54ea4ee393.zip
Better reporting of cyclic references involving imports.
Used to be "cyclic reference involving val <import>". Now prints import statement that caused the error.
Diffstat (limited to 'src/dotty/tools/dotc/printing')
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index db9d50a0a..6728b8395 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -6,6 +6,7 @@ import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Constants._
import Contexts.Context, Scopes.Scope, Denotations.Denotation, Annotations.Annotation
import StdNames.nme
import ast.{Trees, untpd}
+import typer.Namer
import Trees._
import scala.annotation.switch
@@ -433,6 +434,19 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
else parent
}
+ override def toText(sym: Symbol): Text = {
+ if (sym.name == nme.IMPORT) {
+ val info = if (sym.isCompleted) sym.info else sym.completer
+ def importString(tree: untpd.Tree) = s"import ${tree.show}"
+ info match {
+ case info: Namer#Completer => return importString(info.original)
+ case info: ImportType => return importString(info.expr)
+ case _ =>
+ }
+ }
+ super.toText(sym)
+ }
+
override def kindString(sym: Symbol) = {
val flags = sym.flagsUNSAFE
if (flags is Package) "package"