Skip to content

Commit 31d55e0

Browse files
Merge pull request #13201 from romanowski/scaladoc/source-pos-tasty
Do not update source positions once initizlized
2 parents a28aee1 + d135edd commit 31d55e0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ class TreeUnpickler(reader: TastyReader,
13991399
if (path.nonEmpty) {
14001400
val sourceFile = ctx.getSource(path)
14011401
posUnpicklerOpt match
1402-
case Some(posUnpickler) =>
1402+
case Some(posUnpickler) if !sourceFile.initizlized =>
14031403
sourceFile.setLineIndicesFromLineSizes(posUnpickler.lineSizes)
14041404
case _ =>
14051405
pickling.println(i"source change at $addr: $path")

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

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends
144144
if lineIndicesCache eq null then
145145
lineIndicesCache = calculateLineIndicesFromContents()
146146
lineIndicesCache
147+
148+
def initizlized = lineIndicesCache != null
149+
147150
def setLineIndicesFromLineSizes(sizes: Array[Int]): Unit =
148151
val lines = sizes.length
149152
val indices = new Array[Int](lines + 1)

0 commit comments

Comments
 (0)