diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-16 17:56:17 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-16 17:56:17 +0200 |
commit | dba4f1ec3dc5f489056284aab63c771cdd32561c (patch) | |
tree | ab6af09b871c2a01741fd5bbe874a1e19a3fddea /src/dotty/tools/dotc/printing | |
parent | 682cf32cbe5cebeccf9ea10caf43e74c9cecc7c0 (diff) | |
download | dotty-dba4f1ec3dc5f489056284aab63c771cdd32561c.tar.gz dotty-dba4f1ec3dc5f489056284aab63c771cdd32561c.tar.bz2 dotty-dba4f1ec3dc5f489056284aab63c771cdd32561c.zip |
Bug fixes and improvements in error diagnostics.
Main refactoring: lub/glb moves to type comparers.
Diffstat (limited to 'src/dotty/tools/dotc/printing')
-rw-r--r-- | src/dotty/tools/dotc/printing/PlainPrinter.scala | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index 74c14f96d..6e81d5558 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -128,20 +128,19 @@ class PlainPrinter(_ctx: Context) extends Printer { changePrec(GlobalPrec) { "=> " ~ toText(tp.resultType) } case tp: PolyType => def paramText(name: TypeName, bounds: TypeBounds) = - toText(polyParamName(name)) ~ toText(bounds) + toText(polyParamName(name)) ~ polyHash(tp) ~ toText(bounds) changePrec(GlobalPrec) { "[" ~ Text((tp.paramNames, tp.paramBounds).zipped map paramText, ", ") ~ "]" ~ toText(tp.resultType) } case PolyParam(pt, n) => - toText(polyParamName(pt.paramNames(n))) + toText(polyParamName(pt.paramNames(n))) ~ polyHash(pt) case AnnotatedType(annot, tpe) => toTextLocal(tpe) ~ " " ~ toText(annot) case tp: TypeVar => - toTextLocal(tp.underlying) ~ "'" // debug for now, so that we can see where the TypeVars are. - case NoPrefix => - "<no-prefix>" + val suffix = if (tp.isInstantiated) "'" else "''" + toTextLocal(tp.underlying) ~ suffix // debug for now, so that we can see where the TypeVars are. case _ => tp.fallbackToText(this) } @@ -154,7 +153,11 @@ class PlainPrinter(_ctx: Context) extends Printer { */ protected def simpleNameString(sym: Symbol): String = nameString(sym.name) - /** The unique id of symbol, after a # */ + /** If -uniqid is set, the hashcode of the polytype, after a # */ + protected def polyHash(pt: PolyType): Text = + "#" + pt.hashCode provided ctx.settings.uniqid.value + + /** If -uniqid is set, the unique id of symbol, after a # */ protected def idString(sym: Symbol): String = if (ctx.settings.uniqid.value) "#" + sym.id else "" |