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

Invalid bounds in JavaTimeChoose #762

Closed
sangamon opened this issue Feb 19, 2021 · 1 comment · Fixed by #769
Closed

Invalid bounds in JavaTimeChoose #762

sangamon opened this issue Feb 19, 2021 · 1 comment · Fixed by #769

Comments

@sangamon
Copy link

Version: 1.15.3

Caused by: org.scalacheck.Gen$Choose$IllegalBoundsError: invalid bounds: low=1, high=0
at org.scalacheck.Gen$Choose$$anon$8.choose(Gen.scala:475)
at org.scalacheck.Gen$Choose$$anon$8.choose(Gen.scala:473)
at org.scalacheck.Gen$Choose$$anon$12.choose(Gen.scala:596)
at org.scalacheck.Gen$.choose(Gen.scala:637)
at org.scalacheck.time.JavaTimeChoose$$anon$2.$anonfun$choose$3(JavaTimeChoose.scala:68)
at org.scalacheck.time.JavaTimeChoose$$anon$2.$anonfun$choose$3$adapted(JavaTimeChoose.scala:55)

Looks like the case where, in #chooseInstant, epochSecond != min.getEpochSecond and epochSecond == max.getEpochSecond == 0.

@sangamon
Copy link
Author

Example (from a debug run):

  • min = "2025-10-06T06:52:06Z"
  • max = "2025-10-06T07:23:11Z"
  • min.getEpochSecond = 1759733526
  • max.getEpochSecond = 1759735391
  • epochSecond: 1759735391
  • minNano = 1
  • maxNano = 0

isomarcte added a commit to isomarcte/scalacheck that referenced this issue Mar 9, 2021
The minimum value of nanoseconds for both Duration and Instant should be 0, unless the second value == the minimum bound's second value. It was incorrectly encoded as 1.

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

Successfully merging a pull request may close this issue.

1 participant