Skip to content

Commit 0147dcb

Browse files
committed
Do not pickle empty packages
Unpickling them may lead to stub symbol errors
1 parent 6ac9bf2 commit 0147dcb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
633633
/** The tree containing only the top-level classes and objects matching either `cls` or its companion object */
634634
def sliceTopLevel(tree: Tree, cls: ClassSymbol)(implicit ctx: Context): List[Tree] = tree match {
635635
case PackageDef(pid, stats) =>
636-
cpy.PackageDef(tree)(pid, stats.flatMap(sliceTopLevel(_, cls))) :: Nil
636+
val slicedStats = stats.flatMap(sliceTopLevel(_, cls))
637+
if (!slicedStats.isEmpty)
638+
cpy.PackageDef(tree)(pid, slicedStats) :: Nil
639+
else
640+
Nil
637641
case tdef: TypeDef =>
638642
val sym = tdef.symbol
639643
assert(sym.isClass)

compiler/test/dotty/tools/dotc/FromTastyTests.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class FromTastyTests extends ParallelTesting {
4747
"hklub0.scala",
4848

4949
// Missing position
50-
"i3000.scala",
5150
"t1203a.scala",
5251
"t2260.scala",
5352
"t4579.scala",

0 commit comments

Comments
 (0)