diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-19 17:20:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-05-23 12:01:39 +0200 |
commit | c0c0a54309a722aa3175fd0ca7028ace52162a53 (patch) | |
tree | 0998533552709fc3f1c65d6286dd436d8957220b /src/dotty/tools/dotc/core/tasty | |
parent | 3e3df656a53ae66434bea94ae7c3a834369e2c39 (diff) | |
download | dotty-c0c0a54309a722aa3175fd0ca7028ace52162a53.tar.gz dotty-c0c0a54309a722aa3175fd0ca7028ace52162a53.tar.bz2 dotty-c0c0a54309a722aa3175fd0ca7028ace52162a53.zip |
Use source module ref as assumed self type when reading Tasty
When reading Tasty we need to pre-set the info of a class to some
ClassInfoType with (as yet) unknown parents and self type. But for
module classes, we need to know the source module at all time, and this
gets determined by the self type. So we now produce a TermRef
for the assumed self type of a module class.
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty')
-rw-r--r-- | src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 535ddd216..7cc390ed0 100644 --- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -646,7 +646,11 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) { val cls = ctx.owner.asClass def setClsInfo(parents: List[TypeRef], selfType: Type) = cls.info = ClassInfo(cls.owner.thisType, cls, parents, cls.unforcedDecls, selfType) - setClsInfo(Nil, NoType) + val assumedSelfType = + if (cls.is(Module) && cls.owner.isClass) + TermRef.withSig(cls.owner.thisType, cls.name.sourceModuleName, Signature.NotAMethod) + else NoType + setClsInfo(Nil, assumedSelfType) val localDummy = ctx.newLocalDummy(cls) assert(readByte() == TEMPLATE) val end = readEnd() @@ -659,7 +663,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) { } } val parentRefs = ctx.normalizeToClassRefs(parents.map(_.tpe), cls, cls.unforcedDecls) - val self = + val self = if (nextByte == SELFDEF) { readByte() untpd.ValDef(readName(), readTpt(), EmptyTree).withType(NoType) |