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
I don't think an open Rest<T> can work on this target. Rest arguments are based on native arrays, which are invariant. There is no type in the run-time that would accept both int[] and java.lang.Object[], so declaring one in Haxe is always going to cause problems.
You can produce a similar error with Vector directly:
importhaxe.ds.Vector;
functionmain():Void {
vara=Vector.fromArrayCopy([10]);
t(a); // Exception in thread "main" java.lang.ClassCastException: class [I cannot be cast to class [Ljava.lang.Object; ([I and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')
}
functiont<T>(x:Vector<T>) {
trace(x);
}
The problem with catching this during typing is that the compiler doesn't have a mechanism to disallow something like a generic Vector<T>, and I'm not sure how that would best be expressed either.
This can be worked around by making t inline, because then we can work with the concrete type at the call-site.
openjdk 21.0.2
Haxe nightly 5.0.0-alpha.1+0620b1b
The text was updated successfully, but these errors were encountered: