Skip to content

Commit 5efd007

Browse files
committed
Always pickle package references as TERMREFpkg
Previously, package references could also be pickled as ThisTypes, which presented a problem for the scalac pickler.
1 parent b6f5c6a commit 5efd007

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/dotty/tools/dotc/core/pickling/TreePickler.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,14 @@ class TreePickler(pickler: TastyPickler) {
187187
pickleName(tpe.name); pickleType(tpe.prefix)
188188
}
189189
case tpe: ThisType =>
190-
writeByte(THIS)
191-
pickleType(tpe.tref)
190+
if (tpe.cls.is(Flags.Package) && !tpe.cls.isEffectiveRoot) {
191+
writeByte(TERMREFpkg)
192+
pickleName(qualifiedName(tpe.cls))
193+
}
194+
else {
195+
writeByte(THIS)
196+
pickleType(tpe.tref)
197+
}
192198
case tpe: SuperType =>
193199
writeByte(SUPERtype)
194200
withLength { pickleType(tpe.thistpe); pickleType(tpe.supertpe)}

0 commit comments

Comments
 (0)