You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitA {
typeTvarv:T
}
objectB {
deff(x : { valy:A }) { x.y.v = x.y.v }
vara:A= _
varb:Boolean=falsedefy:A= {
if(b) {
a =newA { typeT=Int; varv=1 }
a
} else {
a =newA { typeT=String; varv="" }
b =true
a
}
}
}
Scala 2.8.0.r18050-b20090618020144 compiles this code without errors. But it is unsound:
scala>B.f(B)
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at B$$$$anon$$2.v_$$eq(<console>:15)
at B$$.f(<console>:6)
at .<init>(<console>:7)
at .<clinit>(<console>)
at RequestResult$$.<init>(<console>:4)
at RequestResult$$.<clinit>(<console>)
at RequestResult$$result(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
The text was updated successfully, but these errors were encountered:
Scala 2.8.0.r18050-b20090618020144 compiles this code without errors. But it is unsound:
The text was updated successfully, but these errors were encountered: