scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

ArraySeq[Int] initializes with null #4274

Closed scabug closed 13 years ago

scabug commented 13 years ago

=== What steps will reproduce the problem (please be specific and use wikiformatting)? === in the interactive shell type this

scala> val a = new scala.collection.mutable.ArraySeq[Int](10)
a: scala.collection.mutable.ArraySeq[Int] = ArraySeq(null, null, null, null, null, null, null, null, null, null)

scala> a(0) == null
<console>:7: warning: comparing values of types Int and Null using `==' will always yield false
       a(0) == null
            ^
res3: Boolean = true

scala> 

=== What is the expected behavior? ===

I would expect a specialized ArraySeq that initializes with 0 and does not use boxed Ints

val a = new scala.collection.mutable.ArraySeq[Int](10)
a: scala.collection.mutable.ArraySeq[Int] = ArraySeq(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

=== What versions of the following are you using? ===

scabug commented 13 years ago

Imported From: https://issues.scala-lang.org/browse/SI-4274?orig=1 Reporter: Krux (krux)

scabug commented 13 years ago

@paulp said:

2996.