aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-09 11:41:22 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-01 13:55:12 +0100
commit7263d25b463423677c9e632088b813fadce464ba (patch)
tree75aedbdad7c0f2575921ab085a8471b2405e4768 /compiler/src/dotty/tools
parentb9350f40990ce07ba7614a0448a98abd7075abe8 (diff)
downloaddotty-7263d25b463423677c9e632088b813fadce464ba.tar.gz
dotty-7263d25b463423677c9e632088b813fadce464ba.tar.bz2
dotty-7263d25b463423677c9e632088b813fadce464ba.zip
Better printing of import symbols
Had duplications of `import` before. Also: add import info when printing contexts.
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Contexts.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala8
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala
index 639c4d111..ac722f390 100644
--- a/compiler/src/dotty/tools/dotc/core/Contexts.scala
+++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala
@@ -422,9 +422,11 @@ object Contexts {
final def withOwner(owner: Symbol): Context =
if (owner ne this.owner) fresh.setOwner(owner) else this
- override def toString =
+ override def toString = {
+ def iinfo(implicit ctx: Context) = if (ctx.importInfo == null) "" else i"${ctx.importInfo.selectors}%, %"
"Context(\n" +
- (outersIterator map ( ctx => s" owner = ${ctx.owner}, scope = ${ctx.scope}") mkString "\n")
+ (outersIterator map ( ctx => s" owner = ${ctx.owner}, scope = ${ctx.scope}, import = ${iinfo(ctx)}") mkString "\n")
+ }
}
/** A condensed context provides only a small memory footprint over
diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 00627fc28..1ddf3cd6d 100644
--- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -614,14 +614,12 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
(sym.allOverriddenSymbols exists (_ is TypeParam))
override def toText(sym: Symbol): Text = {
- if (sym.isImport) {
- def importString(tree: untpd.Tree) = s"import ${tree.show}"
+ if (sym.isImport)
sym.infoOrCompleter match {
- case info: Namer#Completer => return importString(info.original)
- case info: ImportType => return importString(info.expr)
+ case info: Namer#Completer => return info.original.show
+ case info: ImportType => return s"import $info.expr.show"
case _ =>
}
- }
if (sym.is(ModuleClass))
kindString(sym) ~~ (nameString(sym.name.stripModuleClassSuffix) + idString(sym))
else