Aladdin - Scala Bugtracking
[#1192] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Gilles Martin fixed 2007-06-28 12:37:30.0
subject 2d array argument to type-parametric function raises class cast
code
val v1: Array[Array[Int]] = Array(Array(1, 2,), Array(3, 4))
def f[T](w: Array[Array[T]]) = ()
f(v1)
what happened
At runtime:
java.lang.ClassCastException: [[I
at "f(v1)"
what expected

Successful execution.

The call f(v1) is transformed into f(v1().$asInstanceOf[Array[runtime.BoxedArray]]()), but the inner array cannot be assumed to be boxed (it isn't for that matter). The operation to make the argument compatible with f's parameter type must be more complex.

[back to overview]
Changes of this bug report
Martin  edited on  2007-07-03 18:49:11.0