Skip to content

Commit 62c0e6d

Browse files
authored
Merge pull request scala/scala#10525 from yzia2000/fix/12822
fix: SliceIterator to drop a max of Int.MaxValue
2 parents 43a4bc7 + e590d33 commit 62c0e6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/src/scala/collection/Iterator.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,10 @@ object Iterator extends IterableFactory[Iterator] {
12591259
else adjustedBound min (until - lo) // keep lesser bound
12601260
if (rest == 0) empty
12611261
else {
1262-
dropping += lo
1262+
dropping = {
1263+
val sum = dropping + lo
1264+
if (sum < 0) Int.MaxValue else sum
1265+
}
12631266
remaining = rest
12641267
this
12651268
}

0 commit comments

Comments
 (0)