-
Notifications
You must be signed in to change notification settings - Fork 408
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
Prop.all is not stack-safe #748
Comments
That change was merged and released in version 1.14.1. It's surprising it took so long for this to be noticed, but not a lot of people use We have a trivial test of
Again, don't try running the above test. It only works because I removed everything except the |
Yeah, I agree. It would be better to preserve the new versions Erik wrote of I believe the following would be the simplest solution, def combine(p: => Prop)(f: (Result, Result) => Result) =
Prop(prms => f(this(prms), p(prms))) However, I believe the seed should be different for the props. I'd need to test it further, but hopefully @non will be able to weigh in. |
Then we should use |
I suggested that it would be worth preserving the new versions of |
The current implementation of
Prop.all
is not stack-safe:scalacheck/src/main/scala/org/scalacheck/Prop.scala
Lines 428 to 431 in 281d93c
The
_ && _
expression creates a long chain offlatMap
calls, which may blow the stack.Note that the implementation changed in #531 (cc @non), and the previous implementation was stack-safe (it used the
&&
operation onProp.Result
instead ofProp
itself).I believe we could write a stack-safe implementation of
Prop#combine
, which is used byProp#&&
.The text was updated successfully, but these errors were encountered: