From 452748a5a84b767cb82cb9f8625c4b19f40cbb03 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 10 Oct 2013 18:31:19 +0200 Subject: Modified printing of variant aliases Now displayed with =+, =-. --- src/dotty/tools/dotc/printing/PlainPrinter.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') 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) => -- cgit v1.2.3