Skip to content

AbstractMethodError with missing bridge for path-dependent type (2.12 only) #336

Closed
@sjrd

Description

@sjrd

Reproduction:

object Main {
  final def main(args: Array[String]): Unit = {
    val f: A => Any = { a =>
      case class Case(abc: a.b.C)
      foo(Case, new a.b.C)
    }
    println(f(new A(new B)))
  }
 
  def foo[A, B](f: A => B, a: A): B = f(a)
}
 
class A(val b: B)
class B {
  class C
}

Scastie: http://scastie.org/29090

The companion object of Case, which extends Function1[a.b.C, Case], is missing its apply(Object)Object bridge. It only has apply(B$C)Case.

Moving the definition of Case outside of the lambda (but still inside main) causes it to run without error. And indeed, in that case, it has the appropriate bridge.

This only happens on 2.12 (tested with 2.12.1).

/cc @aholland

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions