diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 76bce7920..c3f36cc46 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -13,6 +13,7 @@ import Trees._ import TypeApplications._ import Decorators._ import config.Config +import transform.SymUtils._ import scala.annotation.switch import language.implicitConversions @@ -58,11 +59,12 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { protected val PrintableFlags = (SourceModifierFlags | Label | Module | Local).toCommonFlags - override def nameString(name: Name): String = name.decode.toString + override def nameString(name: Name): String = + if (ctx.settings.debugNames.value) name.debugString else name.decode.toString override protected def simpleNameString(sym: Symbol): String = { val name = if (ctx.property(XprintMode).isEmpty) sym.originalName else sym.name - nameString(if (sym is ExpandedTypeParam) name.asTypeName.unexpandedName else name) + nameString(if (sym.is(TypeParam)) name.asTypeName.unexpandedName else name) } override def fullNameString(sym: Symbol): String = @@ -130,7 +132,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { if (defn.isTupleClass(cls)) return toTextTuple(args) return (toTextLocal(tycon) ~ "[" ~ Text(args map argText, ", ") ~ "]").close case tp: TypeRef => - val hideType = !ctx.settings.debugAlias.value && (tp.symbol is AliasPreferred) + val hideType = !ctx.settings.debugAlias.value && (tp.symbol.isAliasPreferred) if (hideType && !ctx.phase.erasedTypes && !tp.symbol.isCompleting) { tp.info match { case TypeAlias(alias) => return toText(alias) @@ -154,8 +156,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { // one version of the annotation tree that has the correct positions). withoutPos(super.toText(tp)) case tp: SelectionProto => - return "?{ " ~ toText(tp.name) ~ (" " provided !tp.name.decode.last.isLetterOrDigit) ~ - ": " ~ toText(tp.memberProto) ~ " }" + return "?{ " ~ toText(tp.name) ~ + (" " provided !tp.name.toSimpleName.decode.last.isLetterOrDigit) ~ + ": " ~ toText(tp.memberProto) ~ " }" case tp: ViewProto => return toText(tp.argType) ~ " ?=>? " ~ toText(tp.resultType) case tp @ FunProto(args, resultType, _) => @@ -604,7 +607,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { def optText[T >: Untyped](tree: List[Tree[T]])(encl: Text => Text): Text = if (tree.exists(!_.isEmpty)) encl(blockText(tree)) else "" - override protected def TypeParamRefNameString(name: TypeName): String = + override protected def ParamRefNameString(name: Name): String = name.unexpandedName.toString override protected def treatAsTypeParam(sym: Symbol): Boolean = sym is TypeParam |