diff --git a/src/lib/diff/tree-diff-application.hpp b/src/lib/diff/tree-diff-application.hpp index 836de4aca..5ab996f4b 100644 --- a/src/lib/diff/tree-diff-application.hpp +++ b/src/lib/diff/tree-diff-application.hpp @@ -129,6 +129,10 @@ namespace diff{ throw error::State(_Fmt("Unable to %s element %s from target as demanded; " "no (further) elements in target sequence") % oper % elm , LUMIERA_ERROR_DIFF_CONFLICT); + + if (elm.matches(Ref::CHILD) and not srcPos()->isNamed()) + return; // allow for anonymous pick or delete of children + if (not srcPos()->matches(elm)) throw error::State(_Fmt("Unable to %s element %s from target as demanded; " "found element %s on current target position instead") diff --git a/tests/library/diff/diff-tree-application-test.cpp b/tests/library/diff/diff-tree-application-test.cpp index 964a46b72..0c1508d6c 100644 --- a/tests/library/diff/diff-tree-application-test.cpp +++ b/tests/library/diff/diff-tree-application-test.cpp @@ -107,12 +107,12 @@ namespace test{ DiffSeq mutationDiff() { - return snapshot({after(Ref::ATTRIBS) + return snapshot({after(Ref::ATTRIBS) // fast forward to the first child , find(CHILD_T) , pick(CHILD_A) , skip(CHILD_T) , del(CHILD_T) - , pick(Ref::CHILD) + , pick(Ref::CHILD) // pick a child anonymously , mut(Ref::THIS) , ins(ATTRIB3) , ins(ATTRIB_NODE)