Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE regression in Vector.prependedAll
Also make a corresponding fix to appenededAll. This isn't exercised by the test case though.
- Loading branch information
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
object Test extends App { | ||
|
||
val vector1 = Vector.fill(1000)(0) | ||
|
||
// Some prepending, manifesting the bug seems to require 2 separate prepends | ||
val vector2 = List.fill(25)(1) ++: 2 +: vector1 | ||
|
||
// Now append for fun and profit | ||
val vector3 = vector2 ++ List.fill(40)(3) | ||
|
||
// Any iteration will do although might hit NullPointerException in different place | ||
val vector4 = vector3.collect { case n => n } | ||
assert(vector3 == vector4) | ||
} |