Skip to content

Static forwarders for inherited polymorphic methods use erased type Object #5289

Open
@scabug

Description

@scabug
abstract class A[T] {
  def m(x: T): T = x
}
object Test extends A[String]

The static forwarder generated in Test has type m(Ljava/lang/Object;)Ljava/lang/Object, it should use Strings, and introduce casts where necessary.

The forwarder is generated in BCodeHelpers.addForwarder. The signature is taken "as-seen-from" the module, the code is val methodInfo = moduleClass.thisType.memberInfo(m), however we're at a late phase where T is already erased to Object.

We should take the signature enteringErasure, but then we have to manually run erasure, and possibly other transforms (lambdalift, mixin).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions