You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scala>try { ((0L).until(Int.MaxValue.toLong +1)).iterator } catch { caseex: IllegalArgumentException=> ex.printStackTrace }
java.lang.IllegalArgumentException:More than Int.MaxValue elements.
at scala.collection.immutable.NumericRange$.check$1(NumericRange.scala:433)
at scala.collection.immutable.NumericRange$.count(NumericRange.scala:443)
at scala.collection.immutable.NumericRange.length$lzycompute(NumericRange.scala:76)
at scala.collection.immutable.NumericRange.length(NumericRange.scala:76)
at scala.collection.immutable.NumericRange.last(NumericRange.scala:84)
at scala.collection.immutable.NumericRange$NumericRangeIterator.<init>(NumericRange.scala:530)
at scala.collection.immutable.NumericRange.iterator(NumericRange.scala:56)
Problem
In the spirit of the fix in scala/scala#10259, NumericRangeIterator could possible be reworked in terns of crossesTheEndAfterN to avoid calling length and tripping the exception
The text was updated successfully, but these errors were encountered:
Reproduction steps
Scala version: 2.13.16
Problem
In the spirit of the fix in scala/scala#10259,
NumericRangeIterator
could possible be reworked in terns ofcrossesTheEndAfterN
to avoid callinglength
and tripping the exceptionThe text was updated successfully, but these errors were encountered: