aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/printing/PlainPrinter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-04-04 19:43:00 +0200
committerMartin Odersky <odersky@gmail.com>2015-04-07 23:53:58 +0200
commitaf90fc5dd6606992763206929596bbcb6d5cba3c (patch)
treeeea281d0201f4ad100c89b0623b6b09da8b54f2e /src/dotty/tools/dotc/printing/PlainPrinter.scala
parentc369fae2fc7dc1a9388b1681276eb3f2dd01e98f (diff)
downloaddotty-af90fc5dd6606992763206929596bbcb6d5cba3c.tar.gz
dotty-af90fc5dd6606992763206929596bbcb6d5cba3c.tar.bz2
dotty-af90fc5dd6606992763206929596bbcb6d5cba3c.zip
Better homogenized types for testing the pickler
Will now also re-normalize And/OrTypes because sometimes they were not yet normalized before pickling.
Diffstat (limited to 'src/dotty/tools/dotc/printing/PlainPrinter.scala')
-rw-r--r--src/dotty/tools/dotc/printing/PlainPrinter.scala13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala
index 0fd862afb..8669db9a0 100644
--- a/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -37,10 +37,15 @@ class PlainPrinter(_ctx: Context) extends Printer {
/** If true, tweak output so it is the same before and after pickling */
protected def homogenizedView: Boolean = ctx.settings.YtestPickler.value
- def homogenize(tp: Type): Type = tp match {
- case tp: TypeVar if homogenizedView && tp.isInstantiated => homogenize(tp.instanceOpt)
- case _ => tp
- }
+ def homogenize(tp: Type): Type =
+ if (homogenizedView)
+ tp match {
+ case tp: TypeVar if tp.isInstantiated => homogenize(tp.instanceOpt)
+ case AndType(tp1, tp2) => homogenize(tp1) & homogenize(tp2)
+ case OrType(tp1, tp2) => homogenize(tp1) | homogenize(tp2)
+ case _ => tp
+ }
+ else tp
/** Render elements alternating with `sep` string */
protected def toText(elems: Traversable[Showable], sep: String) =