Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt at fixing #269.
With the fix in 3c1f147 we are able to derive a straight-forward, type-correct generator for
type t = Foo of t list
(yay!)which blows the stack (less yay):
I think this is to be expected from the current simple, but predictable approach.
It could potentially be improved if we incorporate passing sizing explicitly to the derived
list
generator and thus try to reach a base-case that way.While fixing this I noticed there was also a problem with record declarations in
is_rec_constr_decl
.With the fix in daa357e for that, one can derive a functioning generator for a type like
type t = Foo | Bar of { baz : t }
:Overall, this PR should leave the deriver in a slightly better shape than before.
I don't claim it to be bugfree on all language cases though - I think there are still
core_type
cases inast.ml
that we may not be handling correctly, e.g., for type constraints.