Skip to content

Commit 8ac4db2

Browse files
committed
.
1 parent e914efe commit 8ac4db2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
5555
def sourcePos(using Context): SourcePosition =
5656
val info = WrappedSourceFile.locateMagicHeader(source)
5757
info match
58-
case HasHeader(offset, originalFile) =>
59-
if span.start >= offset then // This span is in user code
58+
// This span is in user code
59+
case HasHeader(offset, originalFile)
60+
if span != NoSpan && span.start >= offset =>
6061
originalFile.atSpan(span.shift(-offset))
61-
else // Otherwise, return the source position in the wrapper code
62-
source.atSpan(span)
62+
// Otherwise, return the source position in the wrapper code
6363
case _ => source.atSpan(span)
6464

6565
/** This positioned item, widened to `SrcPos`. Used to make clear we only need the

0 commit comments

Comments
 (0)