ceylon/ceylon-compiler — Issue #418: Type conversion error
Author: chochos
Created: 2012-03-09 16:16:50+00:00
State: open
Labels: BUG, interoperability

This code compiles OK but throws a ClassCastException at runtime:

````
void loco(Callable[] funcs) {
variable Integer i:= 0;
for (ref in funcs) {
function f(Integer i)=ref;
print(f(i++));
}
}
void run() {
loco({"A".initial, "BB".initial, "CCC".initial});
}
````

````
Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to ceylon.language.Integer
at run$1.call(conv.ceylon:9)
at run$1.call(conv.ceylon:9)
at loco$1f.f(conv.ceylon:4)
at loco.loco(conv.ceylon:5)
at run.run(conv.ceylon:9)
at run.main(conv.ceylon)
````