Skip to content

2d array argument to type-parametric function raises ArrayStoreException #17

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

Closed
scabug opened this issue Aug 28, 2007 · 2 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Aug 28, 2007

The following code:

def transpose[A](arr: Array[Array[A]]) = {
  for (i <- Array.range(0, arr(0).length)) yield
    for (row <- arr) yield row(i)
}

var my_arr = Array(Array(1,2),Array(3,4))

for (i <- Array.range(0, my_arr(0).length)) yield 
  for (row <- my_arr) yield row(i)

transpose(my_arr)

results in
{code}
scala> Loading c:\DOCUME1\pemoore\LOCALS1\Temp\scala_tmp2664zA2...
transpose: AArray[Array[A]]
my_arr: Array[Array[Int]] = [[I@12db7c
res0: Array[Array[Int]] = [[I@1a5e4e4
java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at scala.compat.Platform$$.arraycopy(Platform.scala:31)
at scala.runtime.BoxedAnyArray.unbox(BoxedAnyArray.scala:162)
at scala.runtime.ScalaRunTime$$.arrayValue(ScalaRunTime.scala:126)
at .(:6)
at .()
at RequestResult$$.(:3)
at RequestResult$$.(...
scala> }}

It looks related to 1192, but that bug is supposed to be fixed in my release (2.6.0-RC2)

@scabug
Copy link
Author

scabug commented Aug 28, 2007

Imported From: https://issues.scala-lang.org/browse/SI-17?orig=1
Reporter: Commit Message Bot (anonymous)

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone 2.6.0 deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants