Skip to content

Commit a536ef0

Browse files
committed
Fix #13626
1 parent 7e4ac15 commit a536ef0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/ast/Positioned.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
2323

2424
private var mySpan: Span = _
2525

26+
private var mySource: SourceFile = src
27+
2628
/** A unique identifier in case -Yshow-tree-ids, or -Ydebug-tree-with-id
2729
* is set, -1 otherwise.
2830
*/
@@ -48,7 +50,8 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
4850

4951
span = envelope(src)
5052

51-
val source: SourceFile = src
53+
def source: SourceFile = mySource
54+
5255
def sourcePos(using Context): SourcePosition = source.atSpan(span)
5356

5457
/** This positioned item, widened to `SrcPos`. Used to make clear we only need the
@@ -127,7 +130,7 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
127130
def cloneIn(src: SourceFile): this.type = {
128131
val newpd: this.type = clone.asInstanceOf[this.type]
129132
newpd.allocateId()
130-
// assert(newpd.uniqueId != 2208, s"source = $this, ${this.uniqueId}, ${this.span}")
133+
newpd.mySource = src
131134
newpd
132135
}
133136

0 commit comments

Comments
 (0)