Skip to content

Commit bf3946d

Browse files
committed
Unpickler always takes source from context
... when setting positions
1 parent e6f56b9 commit bf3946d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,10 @@ class TreeUnpickler(reader: TastyReader,
13161316
*/
13171317
def sourceChangeContext(addr: Addr = currentAddr)(implicit ctx: Context): Context = {
13181318
val path = sourcePathAt(addr)
1319-
if (path.nonEmpty) ctx.withSource(ctx.getSource(path))
1319+
if (path.nonEmpty) {
1320+
pickling.println(i"source change at $addr: $path")
1321+
ctx.withSource(ctx.getSource(path))
1322+
}
13201323
else ctx
13211324
}
13221325

@@ -1332,7 +1335,7 @@ class TreeUnpickler(reader: TastyReader,
13321335
/** Set position of `tree` at given `addr`. */
13331336
def setPos[T <: untpd.Tree](addr: Addr, tree: T)(implicit ctx: Context): tree.type = {
13341337
val pos = posAt(addr)
1335-
if (pos.exists) tree.setPosUnchecked(pos)
1338+
if (pos.exists) tree.setPosUnchecked(pos, ctx.source.file)
13361339
tree
13371340
}
13381341
}

0 commit comments

Comments
 (0)