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
classFoo {
inlinedeffun(x: String):String= x
deffoo= fun("abc")
}
sbt:dotty> dotc Foo.scala -Xprint:front -Yprint-pos -Ydebug-pos
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
[info] Running (fork) dotty.tools.dotc.Main -classpath /Users/nicolasstucki/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.8.jar:/Users/nicolasstucki/GitHub/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.14/dotty-library_0.14-0.14.0-bin-SNAPSHOT.jar Foo.scala -Xprint:front -Yprint-pos -Ydebug-pos
result of Foo.scala after frontend:
package <empty>@Foo.scala<0..0> {
class Foo() extends [email protected]<6..6>@
Foo.scala<6..6>
()@Foo.scala<6..6> {
inline def fun(
x: [email protected]<32..38>@
Foo.scala[29..38]
): [email protected]<41..47> =
[email protected]<50..51> :
[email protected]<41..47>
@Foo.scala<41..51>
@Foo.scala[14..25..51]
def foo: String =
/* inlined from
[email protected]<64..64>.fun@
Foo.scala<64..67>
("abc"@Foo.scala<68..73>)@
Foo.scala<64..74>
*/
{
"abc"@Foo.scala<50..51> :
[email protected]<41..47>
@Foo.scala<64..74>
}
@Foo.scala<64..74>
@Foo.scala[54..58..74]
}@Foo.scala[0..6..76]
}@Foo.scala<0..76>
We can see that the position before inlining was "abc"@Foo.scala<68..73> but after inlining it becomes "abc"@Foo.scala<50..51> which is the position of the x in the body of fun.
We can see that the position before inlining was
"abc"@Foo.scala<68..73>
but after inlining it becomes"abc"@Foo.scala<50..51>
which is the position of thex
in the body offun
.#6024 will add a way to test these positions.
The text was updated successfully, but these errors were encountered: