Details

Type: Enhancement

Status: Open

Priority: Minor

Resolution: Unresolved

Affects Version/s: None

Fix Version/s: None

Component/s: None

Labels:None
Description
^{}Gary Fredericks commented that the rosefilter will discard a node and all of its children if the node doesn't pass the predicate. On the other hand, some of its children may pass the predicate.
^{}Reid Draper said that he has attempted to solve this previously, but it was not evident how one should exclude a node from the tree. One solution considered was to replace the node with all of its children, then repeat the procedure recursively.
^{}Gary Fredericks came with another solution, where you promote the first child to the root and concatenate the remaining children to the first child's children.
Am I correct in thinking the motivation here is to make suchthat applied to generators still find the minimal failing example in all cases?
If so, a complete fix seems impractical. Say we have a tree that lets us shrink from C to B to A, but B fails the predicate while C and A pass. Then it's fairly straightforward to keep A in:
becomes
But what if multiple levels are taken out? Say the shrink is like Y→X1→X2→X3→...→Xn→W where Y and W pass the predicate but all the Xs don't? If we accommodate that, then a single call to (first (children Y)) could, in the worst case, require eager exploration of the entire tree under Y, which could easily be exponential.