diff options
author | Martin Odersky <odersky@gmail.com> | 2017-04-10 16:14:50 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-10 16:14:50 +0200 |
commit | 529346d241459f0d20e607fb5ea78b6091c8bc12 (patch) | |
tree | f5101761c5605fbe94b7192ab7fe9af8c203570b /compiler/src/dotty/tools | |
parent | 7294180d28dcbb3ba84ae302084a0806e76fa8a0 (diff) | |
download | dotty-529346d241459f0d20e607fb5ea78b6091c8bc12.tar.gz dotty-529346d241459f0d20e607fb5ea78b6091c8bc12.tar.bz2 dotty-529346d241459f0d20e607fb5ea78b6091c8bc12.zip |
Handle printing of term paramrefs
These were not printed before, fell back to toString method.
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 12 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index d5014b547..c762bbeaf 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -134,7 +134,7 @@ class PlainPrinter(_ctx: Context) extends Printer { case tp: TypeType => toTextRHS(tp) case tp: TermRef - if !tp.denotationIsCurrent && !homogenizedView || // always print underyling when testing picklers + if !tp.denotationIsCurrent && !homogenizedView || // always print underlying when testing picklers tp.symbol.is(Module) || tp.symbol.name.isImportName => toTextRef(tp) ~ ".type" @@ -183,7 +183,9 @@ class PlainPrinter(_ctx: Context) extends Printer { toTextGlobal(tp.resultType) } case tp: TypeParamRef => - TypeParamRefNameString(tp) ~ lambdaHash(tp.binder) + ParamRefNameString(tp) ~ lambdaHash(tp.binder) + case tp: TermParamRef => + ParamRefNameString(tp) ~ ".type" case AnnotatedType(tpe, annot) => toTextLocal(tpe) ~ " " ~ toText(annot) case HKApply(tycon, args) => @@ -206,10 +208,10 @@ class PlainPrinter(_ctx: Context) extends Printer { } }.close - protected def TypeParamRefNameString(name: TypeName): String = name.toString + protected def ParamRefNameString(name: Name): String = name.toString - protected def TypeParamRefNameString(param: TypeParamRef): String = - TypeParamRefNameString(param.binder.paramNames(param.paramNum)) + protected def ParamRefNameString(param: ParamRef): String = + ParamRefNameString(param.binder.paramNames(param.paramNum)) /** The name of the symbol without a unique id. Under refined printing, * the decoded original name. diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 76bce7920..0b683d90c 100644 --- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -604,7 +604,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 |