From 2575d11bd1a670ace8bd7e91777ea135759af51f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 13 Oct 2016 09:39:44 +0200 Subject: Preserve all positions in Tasty. The goal is that pickled and unpickled trees should print the same with -Yprintpos. There are several reasons why this is not the case so far. Some of them are fixed in this commit. --- src/dotty/tools/dotc/transform/Pickler.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/transform/Pickler.scala') diff --git a/src/dotty/tools/dotc/transform/Pickler.scala b/src/dotty/tools/dotc/transform/Pickler.scala index 90e62b65c..2fb85b6c0 100644 --- a/src/dotty/tools/dotc/transform/Pickler.scala +++ b/src/dotty/tools/dotc/transform/Pickler.scala @@ -66,7 +66,10 @@ class Pickler extends Phase { override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = { val result = super.runOn(units) if (ctx.settings.YtestPickler.value) - testUnpickler(units)(ctx.fresh.setPeriod(Period(ctx.runId + 1, FirstPhaseId))) + testUnpickler(units)( + ctx.fresh + .setPeriod(Period(ctx.runId + 1, FirstPhaseId)) + .addMode(Mode.ReadPositions)) result } @@ -81,7 +84,7 @@ class Pickler extends Phase { } pickling.println("************* entered toplevel ***********") for ((cls, unpickler) <- unpicklers) { - val unpickled = unpickler.body(ctx.addMode(Mode.ReadPositions)) + val unpickled = unpickler.body testSame(i"$unpickled%\n%", beforePickling(cls), cls) } } -- cgit v1.2.3