You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importscala.quoted.*objectInner:inlinedefpos(inlinex: Any):Unit=${ posImpl('x) }
defposImpl(x: Expr[Any])(usingQuotes):Expr[Unit] =importquotes.reflect.*defprintPos(p: Position):Unit=
println(s"${p.start}..${p.end} of ${p.sourceFile.path} with length ${p.sourceFile.content.get.length}")
printPos(x.asTerm.pos)
printPos(x.asTerm.asInstanceOf[Inlined].body.pos)
'{}
Output
70..71 of /tmp/down/inline-pos/src/main/scala/Main.scala with length 59
70..71 of /tmp/down/inline-pos/src/main/scala/Outer.scala with length 73
Expectation
Something different. The range for both cases is the x in Inner.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 and apply on the PositionModule states that "The range must be contained in the file."
The text was updated successfully, but these errors were encountered:
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."The text was updated successfully, but these errors were encountered: