diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-01 10:36:06 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-01 10:38:21 -0800 |
commit | c05b850cf5655943e861e0b898b253e83e0e094b (patch) | |
tree | 11f6acdfc0cd0ddead69225153286e6d645cd71d /src/library | |
parent | b2a21c4eacdddb0ee59a8c74c8a73e6cc34cb6bc (diff) | |
download | scala-c05b850cf5655943e861e0b898b253e83e0e094b.tar.gz scala-c05b850cf5655943e861e0b898b253e83e0e094b.tar.bz2 scala-c05b850cf5655943e861e0b898b253e83e0e094b.zip |
Fix for slice boundary condition.
Negative "to" index should be normalized to 0 before using it
in a difference operation.
Diffstat (limited to 'src/library')
-rwxr-xr-x | src/library/scala/collection/IndexedSeqOptimized.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/collection/IndexedSeqOptimized.scala b/src/library/scala/collection/IndexedSeqOptimized.scala index e2541f2a66..196e77c91b 100755 --- a/src/library/scala/collection/IndexedSeqOptimized.scala +++ b/src/library/scala/collection/IndexedSeqOptimized.scala @@ -104,7 +104,7 @@ trait IndexedSeqOptimized[+A, +Repr] extends IndexedSeqLike[A, Repr] { self => override /*IterableLike*/ def slice(from: Int, until: Int): Repr = { val lo = math.max(from, 0) - val hi = math.min(until, length) + val hi = math.min(math.max(until, 0), length) val elems = math.max(hi - lo, 0) val b = newBuilder b.sizeHint(elems) |