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

Allow shrinking private unions #567

Merged
merged 1 commit into from
May 4, 2021
Merged

Allow shrinking private unions #567

merged 1 commit into from
May 4, 2021

Conversation

svdijk
Copy link
Contributor

@svdijk svdijk commented May 4, 2021

This PR allows FsCheck to shrink values of unions with private constructors, making the behavior for unions with private constructors consistent with that for records with private constructors.

FsCheck could already derive generators for records and unions with private constructors (for unions, this functionality was added in PR #186). It could also shrink values of records with a private constructor, but not values of unions with a private constructor. Several people have run into that, see issues #401, #436 and #525.

Whether automatically deriving generators and shrinkers for types with a private constructor should be done in general is something that could be discussed (this is also touched upon in issue #436), but since FsCheck already does generator derivation for such types and also does shrinker derivation for such record types, I believe being consistent for such union types is important enough to warrant this PR regardless of said discussion.

@kurtschelfthout kurtschelfthout merged commit 8e42b21 into fscheck:master May 4, 2021
@kurtschelfthout
Copy link
Member

Thank you!

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 this pull request may close these issues.

2 participants