-
Notifications
You must be signed in to change notification settings - Fork 21
AnyRef specialization seems broken in master #5488
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5488?orig=1 |
@non said (edited on Feb 16, 2012 4:00:40 AM UTC): C$mcI$sp
C$mcT$sp So this bug was introduced after that point. |
@paulp said: |
@paulp said: If I make it realistic, it crashes 2.9, but works a little bit in trunk. class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B](v:A, w:B)
object Test {
def main(args:Array[String]) {
println(new C(123, 123).getClass.getName)
println(new C("abc", 123).getClass.getName)
println(new C(123, "abc").getClass.getName)
println(new C("abc", "abc").getClass.getName)
}
}
|
@paulp said: |
@paulp said: Here's a nice realistic one. class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(Int, AnyRef) C](f: (A, B) => C)
object Test {
def main(args:Array[String]) {
def show(x: Any) = println(x.getClass.getName)
show(new C((x: Int, y: Int) => 1))
show(new C((x: Int, y: Int) => "abc"))
show(new C((x: Int, y: AnyRef) => 1))
show(new C((x: Int, y: AnyRef) => "abc"))
show(new C((x: AnyRef, y: Int) => 1))
show(new C((x: AnyRef, y: Int) => "abc"))
show(new C((x: AnyRef, y: AnyRef) => 1))
show(new C((x: AnyRef, y: AnyRef) => "abc"))
}
} Only works for III. C$mcIII$sp
C
C
C
C
C
C
C |
@non said: But I agree, your example is a more realistic case. |
@paulp said: |
@paulp said:
If there is sufficient motivation we can look into whether it makes sense to generate those all-AnyRef specializations, but I have no more time for this right now. |
@non said: |
@paulp said: |
So, while working on #3575 I noticed that AnyRef specialization didn't seem to be working. I created a simple test of AnyRef specialization, noted the failure with master, then tried compiling an example with Scala 2.9.1 and it worked.
Here's the program:
The output on 2.9.1 is:
Whereas on master it is:
I know that there was a change recently from using the (totally arbitrary) T to the (Java standard) L for referring to Object/AnyRef, as well as other AnyRef bugfixes. I'm currently trying to do a bisect to figure out when this example stopped working, but haven't figured it out yet.
The text was updated successfully, but these errors were encountered: