Skip to content

Commit 38327aa

Browse files
committed
[bugfix] map:merge must use-first by default for duplicate keys as per the XQuery 3.1 Specification
1 parent e0282b1 commit 38327aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

exist-core/src/main/java/org/exist/xquery/functions/map/MapFunction.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,10 @@ private Sequence merge(final Sequence[] args) throws XPathException {
259259
throw new XPathException(this, ErrorCodes.FOJS0005, "value for duplicates key was not recognised: " + mapValue.getStringValue());
260260
}
261261
} else {
262-
// TODO(AR) the XQ3.1 spec says that the default for fn:merge#2 should be USE_FIRST... this needs to be revised in a major release of eXist-db
263-
mergeDuplicates = MergeDuplicates.USE_LAST;
262+
mergeDuplicates = MergeDuplicates.USE_FIRST;
264263
}
265264
} else {
266-
// TODO(AR) the XQ3.1 spec says that the default for fn:merge#1 should be USE_FIRST... this needs to be revised in a major release of eXist-db
267-
mergeDuplicates = MergeDuplicates.USE_LAST;
265+
mergeDuplicates = MergeDuplicates.USE_FIRST;
268266
}
269267

270268
final Sequence maps = args[0];

0 commit comments

Comments
 (0)