Creating "OR" preconditions instead of "AND" (#4003) does not actually work #4505
+70
−1
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.
What's changed?
Adds 2 failing tests using declarative recipes as preconditions.
Based on Creating "OR" preconditions instead of "AND", you should be able to use a declarative recipe as a precondition to combine recipes into an “or” clause, but it does not actually work.
Upon debugging, it appears that
DeclarativeRecipe
does not actually overridegetVisitor()
, so whenDeclarativeRecipe.getRecipeList()
callsgetVisitor()
on the declarative recipe used as precondition, it just returnsnoop()
.What's your motivation?
Be able to re-use a configured recipe as precondition for other recipes.
Anything in particular you'd like reviewers to focus on?
or
association #4003 this use-case was documented and later reported as not working.Anyone you would like to review specifically?
#4003 involved a discussion mostly between @timtebeek and @nmck257 who might be interested.
Have you considered any alternatives or workarounds?
Currently the only alternative is to repeat the predicate configuration, using only imperative recipes. If you need a disjunction of conditions, you will have to duplicate the whole recipe, but it may not always work.
Checklist