Skip to content

Commit 9339158

Browse files
committed
Fix ownership of symbols unpickled inside Bind nodes
They should be owned by the Bind symbol owner, not by the Bind symbol itself.
1 parent 7f18d53 commit 9339158

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ class TreeUnpickler(reader: TastyReader,
144144
else {
145145
for (i <- 0 until nrefs) readNat()
146146
if (tag == BIND) {
147-
buf += new OwnerTree(start, tag, fork, end)
148-
goto(end)
147+
// a Bind is never the owner of anything, so we set `end = start`
148+
buf += new OwnerTree(start, tag, fork, end = start)
149149
}
150-
else scanTrees(buf, end)
150+
151+
scanTrees(buf, end)
151152
}
152153
}
153154
else if (tag >= firstNatASTTreeTag) { readNat(); scanTree(buf) }

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ class FromTastyTests extends ParallelTesting {
9494
// Closure type miss match
9595
"eff-dependent.scala",
9696

97-
// Unpickling tree without owner
98-
"patmat-bind-typed.scala",
99-
"t8395.scala",
100-
10197
// Issue unpickling universes
10298
"phantom-decls-1.scala",
10399
"phantom-decls-3.scala",

0 commit comments

Comments
 (0)