Skip to content
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

ArrayBuffer.padTo does not update length #2257

Closed
scabug opened this issue Aug 15, 2009 · 2 comments
Closed

ArrayBuffer.padTo does not update length #2257

scabug opened this issue Aug 15, 2009 · 2 comments

Comments

@scabug
Copy link

scabug commented Aug 15, 2009

scala> import scala.collection.mutable._

scala> var a = ArrayBuffer(0,0,0)
a: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer(0, 0, 0)

scala> a.padTo(5, 0)
res56: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer(0, 0, 0, 0, 0)

scala> a.length
res57: Int = 3 /// EXPECTED: 5

scala> a(4)
java.lang.IndexOutOfBoundsException: 4
        at scala.collection.mutable.ResizableArray$$class.apply(ResizableArray.scala:42)
        at scala.collection.mutable.ArrayBuffer.apply(ArrayBuffer.scala:26)
        at .<init>(<console>:9)
        at .<clinit>(<console>)
        at RequestResult$$.<init>(<console>:4)
        at RequestResult$$.<clinit>(<console>)
        at RequestResult$$result(<console>)
        at sun.reflect.NativeMethodAccess...
/// EXPECTED: should work
@scabug
Copy link
Author

scabug commented Aug 15, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2257?orig=1
Reporter: Alexey Tarasevich (xetas)

@scabug
Copy link
Author

scabug commented Aug 15, 2009

@paulp said:
"Returns a new sequence ..."

@scabug scabug closed this as completed May 18, 2011
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

1 participant