Describe the bug
@adamretter found out that the handling of duplicate keys when merging maps with map:merge is not according to the specification.
Exists uses use-last whereas the XQuery 3.1 specification states use-first must be used.
Expected behavior
Existdb's implementation of map:merge#1 to adhere to the specification.
To Reproduce
xquery version "3.1";
module namespace t="http://exist-db.org/xquery/test";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare
%test:assertTrue
function t:test() {
let $m1 := map{'a':1}
let $m2 := map{'a':2}
let $merged := map:merge(($m1, $m2))
return $merged?a eq $m1?a
};
Context (please always complete the following information):
eXist-db version: 5.3.0-SNAPSHOT
likely all implementations of map:merge are affected
Describe the bug
@adamretter found out that the handling of duplicate keys when merging maps with
map:mergeis not according to the specification.Exists uses
use-lastwhereas the XQuery 3.1 specification statesuse-firstmust be used.Expected behavior
Existdb's implementation of
map:merge#1to adhere to the specification.To Reproduce
Context (please always complete the following information):
eXist-db version: 5.3.0-SNAPSHOT
likely all implementations of map:merge are affected