Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
scabug opened this issue Dec 7, 2011 · 4 comments
Open

Comments

@scabug
Copy link

scabug commented Dec 7, 2011

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).

@scabug
Copy link
Author

scabug commented Dec 7, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5289?orig=1
Reporter: Petr Pudlak (petrp)
Affected Versions: 2.9.1, 2.10.0-M3
See #8293

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Jul 6, 2016

@lrytz said:
related to #8293

@scabug
Copy link
Author

scabug commented Jul 6, 2016

@lrytz said:
This looks rather difficult to fix with the way forwarders are currently done. I think the better solution would be to generate static forwarders earlier in the pipeline and have them transformed normally. Probably the right way to go about this is to implement the @static pre-SIP: scala/docs.scala-lang#491.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants