diff --git a/compiler/src/dotty/tools/dotc/util/SourcePosition.scala b/compiler/src/dotty/tools/dotc/util/SourcePosition.scala index 5aee6965fbaf..db489a3d172b 100644 --- a/compiler/src/dotty/tools/dotc/util/SourcePosition.scala +++ b/compiler/src/dotty/tools/dotc/util/SourcePosition.scala @@ -22,7 +22,7 @@ extends interfaces.SourcePosition with Showable { def point: Int = span.point - def line: Int = if (source.exists) source.offsetToLine(point) else -1 + def line: Int = if (source.file.exists) source.offsetToLine(point) else -1 /** Extracts the lines from the underlying source file as `Array[Char]`*/ def linesSlice: Array[Char] = @@ -42,16 +42,16 @@ extends interfaces.SourcePosition with Showable { def beforeAndAfterPoint: (List[Int], List[Int]) = lineOffsets.partition(_ <= point) - def column: Int = if (source.exists) source.column(point) else -1 + def column: Int = if (source.file.exists) source.column(point) else -1 def start: Int = span.start - def startLine: Int = if (source.exists) source.offsetToLine(start) else -1 - def startColumn: Int = if (source.exists) source.column(start) else -1 + def startLine: Int = if (source.file.exists) source.offsetToLine(start) else -1 + def startColumn: Int = if (source.file.exists) source.column(start) else -1 def startColumnPadding: String = source.startColumnPadding(start) def end: Int = span.end - def endLine: Int = if (source.exists) source.offsetToLine(end) else -1 - def endColumn: Int = if (source.exists) source.column(end) else -1 + def endLine: Int = if (source.file.exists) source.offsetToLine(end) else -1 + def endColumn: Int = if (source.file.exists) source.column(end) else -1 def withOuter(outer: SourcePosition): SourcePosition = SourcePosition(source, span, outer) def withSpan(range: Span) = SourcePosition(source, range, outer)