Skip to content

Error with type of <outer> when inlining from TASTY #3608

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 Nov 30, 2017 · 0 comments
Closed

Error with type of <outer> when inlining from TASTY #3608

nicolasstucki opened this issue Nov 30, 2017 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

Fail to compile from TASTY

class A {
  class Foo {
    inline def inlineMeth: Unit = new Bar
  }
  class Bar
}

class B extends A {
  (new Foo).inlineMeth
}

Can be reproduced with

dotc <source>
dotc -decompile -Ycheck:all B
checking ./B.class after phase frontend
exception while typing  val A_this: B(B.this) = Foo_this.1_<outer> of class class dotty.tools.dotc.ast.Trees$ValDef # 41
exception while typing /* inlined from A*/ 
  {
     val Foo_this: B.this.Foo = new B.this.Foo()
     val A_this: B(B.this) = Foo_this.1_<outer>
    {
      new A_this.Bar()
      ()
    }
  } of class class dotty.tools.dotc.ast.Trees$Inlined # 56
exception while typing @scala.annotation.internal.SourceFile("tests/pos/i1990.scala")  class B ()
   extends
 A() { 
  /* inlined from A*/ 
    {
       val Foo_this: B.this.Foo = new B.this.Foo()
       val A_this: B(B.this) = Foo_this.1_<outer>
      {
        new A_this.Bar()
        ()
      }
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 29
exception while typing package <empty> {
  @scala.annotation.internal.SourceFile("tests/pos/i1990.scala")  class B ()
     extends
   A() { 
    /* inlined from A*/ 
      {
         val Foo_this: B.this.Foo = new B.this.Foo()
         val A_this: B(B.this) = Foo_this.1_<outer>
        {
          new A_this.Bar()
          ()
        }
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 36
*** error while checking ./B.class after phase frontend ***
Exception in thread "main" java.lang.AssertionError: assertion failed: found:    Foo_this.1_<outer>.type
required: B(B.this)


tree = Foo_this.1_<outer>
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:447)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1801)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedValDef$1(Typer.scala:1300)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:1294)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1663)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1726)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:272)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1766)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1789)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:434)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:623)
	at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1093)
	at dotty.tools.dotc.transform.TreeChecker$Checker.super$typedInlined(TreeChecker.scala:419)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedInlined$1(TreeChecker.scala:419)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:180)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedInlined(TreeChecker.scala:419)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1697)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1727)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:272)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1744)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:23)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1740)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:257)
...
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 2, 2017
Tasty needs to know about outer selections as separate trees. So instead of
exposing a name for outer selects we expose a tree format. This allows us to
store the type of tree selection in the tree, which got lost before.

Also: Change format of NAMEDarg to no longer require a length.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 2, 2017
Tasty needs to know about outer selections as separate trees. So instead of
exposing a name for outer selects we expose a tree format. This allows us to
store the type of tree selection in the tree, which got lost before.

Also: Change format of NAMEDarg to no longer require a length.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 6, 2017
Tasty needs to know about outer selections as separate trees. So instead of
exposing a name for outer selects we expose a tree format. This allows us to
store the type of tree selection in the tree, which got lost before.

Also: Change format of NAMEDarg to no longer require a length.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 11, 2017
Tasty needs to know about outer selections as separate trees. So instead of
exposing a name for outer selects we expose a tree format. This allows us to
store the type of tree selection in the tree, which got lost before.

Also: Change format of NAMEDarg to no longer require a length.
odersky added a commit to dotty-staging/dotty that referenced this issue Dec 16, 2017
Tasty needs to know about outer selections as separate trees. So instead of
exposing a name for outer selects we expose a tree format. This allows us to
store the type of tree selection in the tree, which got lost before.

Also: Change format of NAMEDarg to no longer require a length.
allanrenucci added a commit that referenced this issue Dec 18, 2017
Fix #3608: Treat outer selections as separate Tasty tree
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