Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 438b4c1

Browse files
committed
Only shift spans in user code
1 parent 7eaf07a commit 438b4c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
5656
val info = WrappedSourceFile.locateMagicHeader(source)
5757
info match
5858
case HasHeader(offset, originalFile) =>
59-
originalFile.atSpan(span `shift` -offset)
59+
if span.start >= offset then // This span is in user code
60+
originalFile.atSpan(span.shift(-offset))
61+
else // Otherwise, return the source position in the wrapper code
62+
source.atSpan(span)
6063
case _ => source.atSpan(span)
6164

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /