Skip to content

Commit 3456e85

Browse files
authored
Merge pull request #9351 from dotty-staging/avoid-more-io
SourcePosition#line: Avoid unnecessary IO
2 parents 853b0bf + 84d33d4 commit 3456e85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extends interfaces.SourcePosition with Showable {
2222

2323
def point: Int = span.point
2424

25-
def line: Int = if (source.file.exists) source.offsetToLine(point) else -1
25+
def line: Int = if (source.content().length != 0) source.offsetToLine(point) else -1
2626

2727
/** Extracts the lines from the underlying source file as `Array[Char]`*/
2828
def linesSlice: Array[Char] =

0 commit comments

Comments
 (0)