Skip to content

InSuperCall after LambdaLift #484

Closed
Closed
@DarkDimius

Description

@DarkDimius
class S[A](f: A => A, x: A) {
  Console.println(f(x));
}
class T[B](f: B => B, y: B) extends S((x: B) => f(x), y) {
}

after lambda lift

class S extends Object {
    def <init>(f: Function1, x: Object): S = {
      super()
      Console.println(f.apply(x))
      ()
    }
  }
class T extends S {
    def <init>(f: Function1, y: Object): T = {
      super(closure(f | $anonfun$$init$$6:Function1), y)
      T.this.f = f
      ()
    }
    private val f: Function1
    private def $anonfun$$init$$6(f$2: Function1, x: Object): Object = f$2.apply(x)
  }

Where $anonfun$$init$$6 still has InSuperCall flag set. If one tries to call owner on it, module class <empty> will be returned.

I guess lambdaLift should also reset InSuperCall flag when lifting methods.
@odersky WDYT?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions