Skip to content
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

Bridge method omitted with type alias causes AbstractMethodError #8575

Closed
scabug opened this issue May 10, 2014 · 5 comments
Closed

Bridge method omitted with type alias causes AbstractMethodError #8575

scabug opened this issue May 10, 2014 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 10, 2014

This code throws an java.lang.AbstractMethodError:

  class E[F]
  class A
  class B
  class C

  trait Intf {
    type R
    type RR

    def f1(r: R) {
      val rr = f2(r)
      f3(rr) // This call throws an AbstractMethodError
    }

    def f2(r: R): RR
    def f3(r: RR)
  }

  class Impl extends Intf {
    type F = A with B
    type R = E[F]
    type RR = E[F with C]
    // works if I replace by:
    //type RR = E[A with B with C]

    override def f2(r: R): RR = new E[F with C]()
    override def f3(rr: RR) { println("This should be printed")}
  }

  new Impl().f1(new E[A with B]())
@scabug
Copy link
Author

scabug commented May 10, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8575?orig=1
Reporter: Mikael Valot (mikaelv)
Affected Versions: 2.10.4, 2.11.0

@scabug
Copy link
Author

scabug commented Sep 13, 2014

Jonathan Brachthäuser (b-studios) said:
Added a byte code comparison the with working version (where the type alias is manually dealiased to E[A with B with C]) to https://gist.github.com/b-studios/e06f741434b2119ed0f2

The main difference is that the following method implementation is generated for the working version, while it isn't for the version with E[F with C]:

public java.lang.Object id(java.lang.Object);
  Code:
     0: aload_0       
     1: aload_1       
     2: checkcast     #27                 // class E
     5: invokevirtual #29                 // Method id:(LE;)LE;
     8: areturn 

@scabug
Copy link
Author

scabug commented Sep 14, 2014

@Blaisorblade said:
I and Jona took a look today: he minimized the bug report and wrote a minimal fix — PR coming soon.

@scabug
Copy link
Author

scabug commented Sep 14, 2014

Jonathan Brachthäuser (b-studios) said:
scala/scala#3979

@scabug
Copy link
Author

scabug commented Nov 7, 2014

@retronym said:
scala/scala#3981

@scabug scabug closed this as completed Nov 7, 2014
@scabug scabug added this to the 2.12.0-M1 milestone Apr 7, 2017
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

2 participants