Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/ast/Positioned.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
def sourcePos(using Context): SourcePosition =
val info = WrappedSourceFile.locateMagicHeader(source)
info match
case HasHeader(offset, originalFile) =>
if span.start >= offset then // This span is in user code
// This span is in user code
case HasHeader(offset, originalFile)
if span.exists && span.start >= offset =>
originalFile.atSpan(span.shift(-offset))
else // Otherwise, return the source position in the wrapper code
source.atSpan(span)
// Otherwise, return the source position in the wrapper code
case _ => source.atSpan(span)

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