Skip to content

Commit 7a33145

Browse files
committed
WIP
1 parent 18eb4ce commit 7a33145

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ class PositionPickler(pickler: TastyPickler, addrOfTree: untpd.Tree => Addr) {
4545

4646
def pickleSource(source: SourceFile): Unit = {
4747
buf.writeInt(SOURCE)
48-
val pathName = source.path
49-
// assert(!java.nio.file.Paths.get(pathName.toString).isAbsolute)
50-
buf.writeInt(pickler.nameBuffer.nameIndex(pathName.toTermName).index)
48+
val jpath = source.file.jpath
49+
val pathName =
50+
if jpath.isAbsolute then jpath.relativize(java.nio.file.Paths.get(".")) else jpath
51+
assert(!pathName.isAbsolute)
52+
buf.writeInt(pickler.nameBuffer.nameIndex(pathName.toString.toTermName).index)
5153
}
5254

5355
/** True if x's position shouldn't be reconstructed automatically from its initial span

0 commit comments

Comments
 (0)