Skip to content

Wrong position for inlined type arguments #6027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolasstucki opened this issue Mar 6, 2019 · 0 comments
Closed

Wrong position for inlined type arguments #6027

nicolasstucki opened this issue Mar 6, 2019 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant