Skip to content

Commit d664600

Browse files
committed
WIP, trying to satisfy pickler
1 parent 35b3d7b commit d664600

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ class PlainPrinter(_ctx: Context) extends Printer {
4545
protected def debugPos: Boolean = ctx.settings.YdebugPos.value
4646

4747
def homogenize(tp: Type): Type =
48-
if (homogenizedView)
49-
tp match {
48+
if (homogenizedView) {
49+
val a = tp.tryNormalize
50+
if (a.exists) {
51+
homogenize(a)
52+
} else tp match {
5053
case tp: ThisType if tp.cls.is(Package) && !tp.cls.isEffectiveRoot =>
5154
ctx.requiredPackage(tp.cls.fullName).termRef
5255
case tp: TypeVar if tp.isInstantiated =>
@@ -62,9 +65,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
6265
case AppliedType(tycon, args) =>
6366
tycon.dealias.appliedTo(args)
6467
case _ =>
65-
tp
68+
tp
6669
}
67-
else tp
70+
} else tp
6871

6972
private def sameBound(lo: Type, hi: Type): Boolean =
7073
try ctx.typeComparer.isSameTypeWhenFrozen(lo, hi)

tests/run/tuples1b.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0
2+
(1)
3+
0
4+
()

tests/run/tuples1b.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object Test extends App {
2+
def x[T](xs: (T, T)): T = xs.head
3+
def x1[T](xs: (T, T)): Tuple1[T] = xs.tail
4+
def x2[T](xs: (T, T)): T = xs(0)
5+
def x3[T](xs: (T, T)): Unit = xs(0)
6+
7+
println(x((0,1)))
8+
println(x1((0,1)))
9+
println(x2((0,1)))
10+
println(x3((0,1)))
11+
12+
}

0 commit comments

Comments
 (0)