Skip to content

Commit 2919b6c

Browse files
committed
Use relative paths in position pickler
Imporve state of #7474
1 parent 3cb93f3 commit 2919b6c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

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

4646
def pickleSource(source: SourceFile): Unit = {
4747
buf.writeInt(SOURCE)
48-
buf.writeInt(pickler.nameBuffer.nameIndex(source.pathName).index)
48+
val jpath = source.file.jpath
49+
// assert(!jpath.isAbsolute, jpath)
50+
buf.writeInt(pickler.nameBuffer.nameIndex(jpath.toString.toTermName).index)
4951
}
5052

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Pickler extends Phase {
7878
pickled.iterator.grouped(10).toList.zipWithIndex.map {
7979
case (row, i) => s"${i}0: ${row.mkString(" ")}"
8080
}
81-
81+
8282
// println(i"rawBytes = \n$rawBytes%\n%") // DEBUG
8383
if (pickling ne noPrinter) {
8484
println(i"**** pickled info of $cls")

compiler/src/dotty/tools/dotc/util/SourceFile.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends
5959
override def path: String = file.path
6060
override def jfile: Optional[JFile] = Optional.ofNullable(file.file)
6161

62-
def pathName: PathName = file.absolutePath.toTermName
63-
6462
override def equals(that: Any): Boolean =
6563
(this `eq` that.asInstanceOf[AnyRef]) || {
6664
that match {

0 commit comments

Comments
 (0)