Skip to content

Commit a2bead9

Browse files
OlivierBlanvillainDarkDimius
authored andcommitted
Partially fix pickling tests failing with smarter tpd
This also seems to be a reason why Ycheck:front fails. typeAssigner is REMOVING partial evaluation that typer did when you copy a tree. It means that types would be different if you test pickling. Update made to homogenize: - Don't print constant types in pickling. - Sort union types according to their .show String
1 parent 3d4cdd7 commit a2bead9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
5353
case AndType(tp1, tp2) =>
5454
homogenize(tp1) & homogenize(tp2)
5555
case OrType(tp1, tp2) =>
56-
homogenize(tp1) | homogenize(tp2)
56+
if (tp1.show > tp2.show)
57+
homogenize(tp1) | homogenize(tp2)
58+
else
59+
homogenize(tp2) | homogenize(tp1)
5760
case tp: SkolemType =>
5861
homogenize(tp.info)
5962
case tp: LazyRef =>

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
125125
("implicit " provided isImplicit) ~ argStr ~ " => " ~ argText(args.last)
126126
}
127127
homogenize(tp) match {
128+
case x: ConstantType if homogenizedView =>
129+
return toText(x.widen)
128130
case AppliedType(tycon, args) =>
129131
val cls = tycon.typeSymbol
130132
if (tycon.isRepeatedParam) return toTextLocal(args.head) ~ "*"

0 commit comments

Comments
 (0)