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;