Closed
Description
class Foo {
inline def fun[T]: T = "".asInstanceOf[T]
type X
def foo = fun[X]
}
sbt:dotty> dotc Foo -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 -Xprint:front -Yprint-pos -Ydebug-pos
result of Foo after frontend:
package <empty>@Foo<0..0> {
class Foo() extends Object@Foo<6..6>@
Foo<6..6>
()@Foo<6..6> {
inline def fun[
T >: Nothing <: Any@Foo<29..29>@
Foo[29..30]
]: T@Foo<33..34> =
""@Foo<37..39>.asInstanceOf@
Foo<37..52>
[T@Foo<53..54>]@
Foo<37..55>
:T@Foo<33..34>@
Foo<33..55>
@Foo[14..25..55]
type X >: Nothing <: Any@Foo<58..58>@
Foo[58..63..64]
def foo: Foo.this.X =
/* inlined from
this@Foo<77..77>.fun@
Foo<77..80>
[Foo.this.X@Foo<81..82>]@
Foo<77..83>
*/
{
""@Foo<37..39>.asInstanceOf@
Foo<37..52>
[Foo.this.X]@Foo<37..55> :
Foo.this.X
@Foo<77..83>
}
@Foo<77..83>
@Foo[67..71..83]
}@Foo[0..6..85]
}@Foo<0..85>
We can see that the position before inlining was [[email protected]<81..82>]
but after inlining it becomes [Foo.this.X]
which is missing the position.
#6024 will add a way to test these positions.
This issue is related to #6026