Allow arbitrary opam depopt disjunction represntations #11099
Closed
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.
Opam currenly represents lists of depopts packages with disjunctions that "stack" no the left-side, such as:
Or(Or(A, B), C)
. This code was originally written to expect disjunctions to stack on the right-side (Or(A, Or(B, C))
). This change generalizes the resolving of depopts so that the representation does not matter, as long as every node isOr
,Atom
, orEmpty
.Since we now traverse both sides of the
Or
node it's tricky to keep thecollect
function tail-recursive so the code is simplified to avoid collecting the atoms into an accumulator. Packages are expected to have a small number of depopts so there's little benefit to keeping it tail-recursive given the code complexity it would add.Fixes #11058