diff options
author | Martin Odersky <odersky@gmail.com> | 2013-10-10 18:31:19 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-10-10 18:31:19 +0200 |
commit | 452748a5a84b767cb82cb9f8625c4b19f40cbb03 (patch) | |
tree | 2a8bee72f51ecdaddf90001cbe35cc609bb5ad83 /src/dotty/tools/dotc/printing | |
parent | 13495dab10ca9db14d12198303f11207b6b2d5dc (diff) | |
download | dotty-452748a5a84b767cb82cb9f8625c4b19f40cbb03.tar.gz dotty-452748a5a84b767cb82cb9f8625c4b19f40cbb03.tar.bz2 dotty-452748a5a84b767cb82cb9f8625c4b19f40cbb03.zip |
Modified printing of variant aliases
Now displayed with =+, =-.
Diffstat (limited to 'src/dotty/tools/dotc/printing')
-rw-r--r-- | src/dotty/tools/dotc/printing/PlainPrinter.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index 8780f60e6..680549489 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -218,10 +218,14 @@ class PlainPrinter(_ctx: Context) extends Printer { /** String representation of a definition's type following its name */ protected def toTextRHS(tp: Type): Text = controlled { tp match { - case TypeBounds(lo, hi) => - if (lo eq hi) - " = " ~ toText(lo) - else + case tp @ TypeBounds(lo, hi) => + if (lo eq hi) { + val eql = + if (tp.variance == 1) " =+ " + else if (tp.variance == -1) " =- " + else " = " + eql ~ toText(lo) + } else (if (lo == defn.NothingType) Text() else " >: " ~ toText(lo)) ~ (if (hi == defn.AnyType) Text() else " <: " ~ toText(hi)) case tp @ ClassInfo(pre, cls, cparents, decls, selfInfo) => |