Skip to content

Commit e590d33

Browse files
committed
fix: SliceIterator to drop a max of Int.MaxValue
resolves scala/scala#12822
1 parent 08bfa48 commit e590d33

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)