Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wide NumericRange#isEmpty throws an IllegalArgumentException #11911

Open
tkawachi opened this issue Mar 18, 2020 · 0 comments
Open

Wide NumericRange#isEmpty throws an IllegalArgumentException #11911

tkawachi opened this issue Mar 18, 2020 · 0 comments

Comments

@tkawachi
Copy link

@tkawachi tkawachi commented Mar 18, 2020

Current implementation of isEmpty uses length method which throws an Exception.

reproduction steps

(0L to Int.MaxValue.toLong).isEmpty

problem

java.lang.IllegalArgumentException: 0 to 2147483647 by 1: seqs cannot contain more than Int.MaxValue elements.
  scala.collection.immutable.Range.fail(Range.scala:175)
  scala.collection.immutable.Range.length(Range.scala:107)
  scala.collection.immutable.NumericRange$.count(NumericRange.scala:306)
  scala.collection.immutable.NumericRange.length$lzycompute(NumericRange.scala:75)
  scala.collection.immutable.NumericRange.length(NumericRange.scala:75)
  scala.collection.immutable.NumericRange.isEmpty(NumericRange.scala:76)

expectation

false
@SethTisue SethTisue added this to the Backlog milestone Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.