Navigation Menu

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

2.9 regression: Former valid Ranges fail with "IllegalArgumentException: Seqs cannot contain more than Int.MaxValue elements" #4321

Closed
scabug opened this issue Mar 7, 2011 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Mar 7, 2011

=== What steps will reproduce the problem? ===

  Int.MinValue to Int.MaxValue by Int.MaxValue

=== What is the expected behavior? ===

  scala.collection.immutable.Range = Range(-2147483648, -1, 2147483646)

=== What do you see instead? ===

java.lang.IllegalArgumentException: Seqs cannot contain more than Int.MaxValue elements.
	at scala.collection.immutable.NumericRange$$.count(NumericRange.scala:205)
	at scala.collection.immutable.Range$$.count(Range.scala:255)
	at scala.collection.immutable.Range.<init>(Range.scala:52)
	at scala.collection.immutable.Range$$Inclusive.<init>(Range.scala:257)
	at scala.runtime.RichInt.to(RichInt.scala:24)

=== What versions of the following are you using? ===

  • Scala: 2.9.0.r24394-b20110307020059
  • Java: Java 1.6.0_21
  • Operating system: OpenJDK 64-Bit Server VM
@scabug
Copy link
Author

scabug commented Mar 7, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4321?orig=1
Reporter: @soc

@scabug
Copy link
Author

scabug commented Mar 8, 2011

@ingoem said:
Paul, could you have a look or comment on the rationale? It seems you introduced NumericRange.count in https://lampsvn.epfl.ch/trac/scala/log/scala/trunk/src/library/scala/collection/immutable/NumericRange.scala?rev=23422&stop_rev=22167

@scabug
Copy link
Author

scabug commented Mar 8, 2011

@soc said:
A related problem is #4308.

I wonder if we have to decide whether to reject things like "Int.MinValue to Int.MaxValue" (by assuming step size is 1) and fail fast or if it is possible to see if there is a "by someInt" following, resulting in an amount of less than Int.MaxValue elements.

Currently both approaches don't work reliably.

@scabug
Copy link
Author

scabug commented Mar 19, 2011

@paulp said:
(In r24508) Some boundary conditions in range. Also bit the bullet on getting
infix implicits to Integral and Fractional. As a bonus this patch
knocked 10,000 long boxings off a specialized test. Who knew.
Closes #4308, #4321, review by community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants