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

ClassCastException with parameterized universal trait #6385

Closed
scabug opened this issue Sep 17, 2012 · 7 comments
Closed

ClassCastException with parameterized universal trait #6385

scabug opened this issue Sep 17, 2012 · 7 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 17, 2012

object N {
   def main(args: Array[String]) {
      val y: AA[Int] = C(2)
      val c: Int = y.x.y
      println(c)
   }
}
trait AA[T] extends Any {
   def x: C[T]
}
case class C[T](val y: T) extends AnyVal with AA[T] {
   def x = this
}
java.lang.ClassCastException: C cannot be cast to java.lang.Integer
	at scala.runtime.BoxesRunTime.unboxToInt(Unknown Source)
	at N$.main(N.scala:4)
	at N.main(N.scala)
@scabug
Copy link
Author

scabug commented Sep 17, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6385?orig=1
Reporter: @harrah
Affected Versions: 2.10.0
See #6260

@scabug
Copy link
Author

scabug commented Sep 18, 2012

@scabug
Copy link
Author

scabug commented Sep 18, 2012

@pavelpavlov said:
I believe the root cause of this issue is:
https://groups.google.com/d/msg/scala-sips/KSm99KoiYNA/wuX6j_XgeZEJ

@scabug
Copy link
Author

scabug commented Nov 14, 2012

@paulp said:
Compile-time error in d435f72e5fb7f (noting for reference.)

@scabug
Copy link
Author

scabug commented Oct 25, 2013

@retronym said:
Relates to the side problems reported in the comments of #6260.

I believe this was wrongly resolved with a prohibition. The problem is actually that a spurious bridge is created in cases when the overriding and overridden methods contained parameteric value classes. I have a fix for this in the works.

@scabug
Copy link
Author

scabug commented Oct 28, 2013

@retronym said:
Reopening, patch pending.

@scabug
Copy link
Author

scabug commented Oct 28, 2013

@retronym said:
scala/scala#3082

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