Open felher opened 3 weeks ago
I don't know the API but printPos(Position.ofMacroExpansion)
is correct.
Note, for the given examples I'm getting:
70..71 of /tmp//position-bug/Main.scala with length 58
70..71 of /tmp/position-bug/Outer.scala with length 72
likely an extra line was added somewhere to get the +1 result.
Anyway, tagging @jchyb & @bishabosha for opinions on this.
On "terminal newline" at EOF, which Scala 2 adds to source text for ease of use, really does simplify, as a sentinel. "Trim to end of line" instead of "EOL or EOF". (That was my recent use case.)
Compiler version
Tested on both 3.5.2 and 3.6.1
I tested on 3.6.1 as well because it already contains #21793
Main.scala
Outer.scala
Inner.scala
Output
Expectation
Something different. The range for both cases is the
x
inInner.pos(x)
in Outer.scala, but the source file for the first one is Main.scala.I thought maybe using inlining means that they are allowed to get inconsistent, but the docs on
.start
,.end
clearly state that they are offsets in the source file andapply
on thePositionModule
states that "The range must be contained in the file."