diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index bbcfe509fd21..679c43f76a36 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -239,7 +239,7 @@ object Contexts { } /** Sourcefile with given path name, memoized */ - def getSource(path: SourceFile.PathName): SourceFile = base.sourceNamed.get(path) match { + def getSource(path: TermName): SourceFile = base.sourceNamed.get(path) match { case Some(source) => source case None => @@ -685,7 +685,7 @@ object Contexts { /** Sources that were loaded */ val sources: mutable.HashMap[AbstractFile, SourceFile] = new mutable.HashMap[AbstractFile, SourceFile] - val sourceNamed: mutable.HashMap[SourceFile.PathName, SourceFile] = new mutable.HashMap[SourceFile.PathName, SourceFile] + val sourceNamed: mutable.HashMap[TermName, SourceFile] = new mutable.HashMap[TermName, SourceFile] // Types state /** A table for hash consing unique types */ diff --git a/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala index 20b5ddd8703c..280d858eda69 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/PositionPickler.scala @@ -45,7 +45,7 @@ class PositionPickler(pickler: TastyPickler, addrOfTree: untpd.Tree => Addr) { def pickleSource(source: SourceFile): Unit = { buf.writeInt(SOURCE) - buf.writeInt(pickler.nameBuffer.nameIndex(source.pathName).index) + buf.writeInt(pickler.nameBuffer.nameIndex(source.path.toTermName).index) } /** True if x's position shouldn't be reconstructed automatically from its initial span diff --git a/compiler/src/dotty/tools/dotc/transform/Pickler.scala b/compiler/src/dotty/tools/dotc/transform/Pickler.scala index 21e748ec594e..4b0b77205936 100644 --- a/compiler/src/dotty/tools/dotc/transform/Pickler.scala +++ b/compiler/src/dotty/tools/dotc/transform/Pickler.scala @@ -78,7 +78,7 @@ class Pickler extends Phase { pickled.iterator.grouped(10).toList.zipWithIndex.map { case (row, i) => s"${i}0: ${row.mkString(" ")}" } - + // println(i"rawBytes = \n$rawBytes%\n%") // DEBUG if (pickling ne noPrinter) { println(i"**** pickled info of $cls") diff --git a/compiler/src/dotty/tools/dotc/util/SourceFile.scala b/compiler/src/dotty/tools/dotc/util/SourceFile.scala index a22f6db0c927..3b32e77ebc81 100644 --- a/compiler/src/dotty/tools/dotc/util/SourceFile.scala +++ b/compiler/src/dotty/tools/dotc/util/SourceFile.scala @@ -9,10 +9,8 @@ import java.io.IOException import scala.internal.Chars._ import Spans._ import scala.io.Codec -import core.Names.TermName import core.Contexts.Context import scala.annotation.internal.sharable -import core.Decorators.PreNamedString import java.util.concurrent.atomic.AtomicInteger import scala.collection.mutable @@ -59,8 +57,6 @@ class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends override def path: String = file.path override def jfile: Optional[JFile] = Optional.ofNullable(file.file) - def pathName: PathName = file.absolutePath.toTermName - override def equals(that: Any): Boolean = (this `eq` that.asInstanceOf[AnyRef]) || { that match { @@ -202,8 +198,6 @@ object SourceFile { implicit def fromContext(implicit ctx: Context): SourceFile = ctx.source - type PathName = TermName - def fromId(id: Int): SourceFile = sourceOfChunk(id >> ChunkSizeLog) def virtual(name: String, content: String) = new SourceFile(new VirtualFile(name, content.getBytes), scala.io.Codec.UTF8)