Skip to content

Erasure-created bridge clash detection is incomplete #2202

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

Closed
smarter opened this issue Apr 7, 2017 · 1 comment
Closed

Erasure-created bridge clash detection is incomplete #2202

smarter opened this issue Apr 7, 2017 · 1 comment

Comments

@smarter
Copy link
Member

smarter commented Apr 7, 2017

Same bug as SI-9912, this shouldn't compile:

class A {
  def compareTo(o: Any): Int = 0
}
class B extends A with Comparable[B] {
  def compareTo(b: B): Int = 0
}
object C {
  def main(args: Array[String]): Unit = {
    println(new B().compareTo(new Object()))
  }
}

... but it does and crash at runtime:

Exception in thread "main" java.lang.ClassCastException: java.lang.Object cannot be cast to B
        at B.compareTo(t9912.scala:5)
        at C$.main(t9912.scala:9)
        at C.main(t9912.scala)
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 21, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 21, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 1, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 1, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue May 5, 2017
@odersky
Copy link
Contributor

odersky commented May 5, 2017

Fixed by bridges changes, with error message cleaned up in #2372.

@odersky odersky closed this as completed May 5, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 5, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 5, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue May 6, 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

3 participants