Skip to content

Commit d1a55d9

Browse files
committed
Use empty roots for tasty terms
1 parent b0400ff commit d1a55d9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ object PickledQuotes {
105105
}
106106

107107
val unpickler = new TastyUnpickler(bytes, splices)
108-
unpickler.enter(Set(ctx.owner))
108+
unpickler.enter(Set.empty)
109109
val tree = unpickler.tree
110110

111111
if (pickling ne noPrinter)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,12 @@ class TreeUnpickler(reader: TastyReader,
869869
nextByte == IMPORT || nextByte == PACKAGE
870870

871871
def readTopLevel()(implicit ctx: Context): List[Tree] = {
872-
@tailrec def read(acc: ListBuffer[Tree]): List[Tree] = nextByte match {
873-
case IMPORT | PACKAGE =>
872+
@tailrec def read(acc: ListBuffer[Tree]): List[Tree] = {
873+
if (isTopLevel) {
874874
acc += readIndexedStat(NoSymbol)
875875
if (!isAtEnd) read(acc) else acc.toList
876-
case _ => // top-level trees which are not imports or packages are not part of tree
876+
}
877+
else // top-level trees which are not imports or packages are not part of tree
877878
acc.toList
878879
}
879880
read(new ListBuffer[tpd.Tree])

compiler/src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Pickler extends Phase {
9494
val unpicklers =
9595
for ((cls, pickler) <- picklers) yield {
9696
val unpickler = new DottyUnpickler(pickler.assembleParts())
97-
unpickler.enter(roots = Set())
97+
unpickler.enter(roots = Set.empty)
9898
cls -> unpickler
9999
}
100100
pickling.println("************* entered toplevel ***********")

0 commit comments

Comments
 (0)