Skip to content

$outer of trait not implemented if the class doesn't need $outer #1820

Closed
@liufengyun

Description

@liufengyun

Following code runs in Scalac, but failed to run in Dotty. Inspecting the generated code shows that the $outer for A.Inner is not implemented in the top-leve class Inner.

class A {
  val a = "a"
  trait Inner {
    def f = println(a)
    def h = 3
  }
}

class Inner extends O.a.Inner

object O {
  val a = new A

  def main(args: Array[String]): Unit = {
    (new Inner).f
  }
}

A fix is in order, will push soon.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions