Skip to content

AbstractMethodError with lambdas #11355

@lrytz

Description

@lrytz
trait A[T] { def apply(x: T): T }
trait B extends A[Int] { def apply(x: Int): Int }

object Test {
  def f: B = (x: Int) => x + 1
  def g: A[Int] = f

  def main(args: Array[String]): Unit = {
    println(f(10))
    println(g(10))
  }
}
$ qsc Test.scala
$ qs Test
11
java.lang.AbstractMethodError: Test$$$Lambda$115/1705929636.apply(Ljava/lang/Object;)Ljava/lang/Object;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions