The current implementation of Prop.all is not stack-safe:
|
/** Combines properties into one, which is true if and only if all the |
|
* properties are true */ |
|
def all(ps: Prop*): Prop = |
|
ps.foldLeft(proved)(_ && _) |
The _ && _ expression creates a long chain of flatMap 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 on Prop.Result instead of Prop itself).
I believe we could write a stack-safe implementation of Prop#combine, which is used by Prop#&&.
The current implementation of
Prop.allis not stack-safe:scalacheck/src/main/scala/org/scalacheck/Prop.scala
Lines 428 to 431 in 281d93c
The
_ && _expression creates a long chain offlatMapcalls, 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.Resultinstead ofPropitself).I believe we could write a stack-safe implementation of
Prop#combine, which is used byProp#&&.