diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-20 13:08:56 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-05-23 12:01:40 +0200 |
commit | e4f87d90414e5cfd590f2549e090e7e0ab8141b8 (patch) | |
tree | 21142dd591e41e44a08d29975875b7323bada53d /src/dotty/tools/dotc/core/unpickleScala2 | |
parent | 67d5660e0be6f0ae411b8fea030acd92a7b27cbf (diff) | |
download | dotty-e4f87d90414e5cfd590f2549e090e7e0ab8141b8.tar.gz dotty-e4f87d90414e5cfd590f2549e090e7e0ab8141b8.tar.bz2 dotty-e4f87d90414e5cfd590f2549e090e7e0ab8141b8.zip |
Make sure local data is unpickled at right phase
We had a problem where unpickling an annotation containing a
class constant had the wrong type. Unpickling was done after erasure.
The type given to the constant was an alias but aliases got
eliminated during erasure, so the constant was malformed.
Unpickling annotation contents at the same phase as unpickling
the annotation carrier solves the problem.
It seems similar problems can arise when data is unpickled
using a LocalUnpickler. So we now make sure local unpickling
runs at the latest at phase Pickler.
Diffstat (limited to 'src/dotty/tools/dotc/core/unpickleScala2')
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index cceaed53d..71a919ca3 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -573,7 +573,8 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas // println(s"unpickled ${denot.debugString}, info = ${denot.info}") !!! DEBUG } atReadPos(startCoord(denot).toIndex, - () => parseToCompletion(denot)(ctx.addMode(Mode.Scala2Unpickling))) + () => parseToCompletion(denot)( + ctx.addMode(Mode.Scala2Unpickling).withPhaseNoLater(ctx.picklerPhase))) } catch { case ex: RuntimeException => handleRuntimeException(ex) } @@ -922,7 +923,8 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val start = readIndex val atp = readTypeRef() Annotation.deferred( - atp.typeSymbol, implicit ctx => atReadPos(start, () => readAnnotationContents(end))) + atp.typeSymbol, implicit ctx1 => + atReadPos(start, () => readAnnotationContents(end)(ctx1.withPhase(ctx.phase)))) } /* Read an abstract syntax tree */ |