-
-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Labels
bugissue confirmed as bugissue confirmed as bugdeprecationxqueryissue is related to xquery implementationissue is related to xquery implementation
Milestone
Description
Describe the bug
eXistDB does not enforce the return type of the user provided filter function.
Relevant spec:
https://www.w3.org/TR/xpath-functions/#func-filter
especially,
there is no special treatment for numeric predicate values, and no conversion to an effective boolean value
Expected behavior
Return types of function parameter to fn:filter other than xs:boolean must throw XPTY0004.
To Reproduce
xquery version "3.1";
module namespace hofs="http://exist-db.org/xquery/test/higher-order-functions";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare
%test:assertError("XPTY0004")
function hofs:function-has-wrong-return-type () {
filter((0 to 1), function ($a) { $a })
};
declare
%test:assertError("XPTY0004")
function hofs:return-mixed-types () {
filter((true(), false(), 1, ""), function ($a) { $a })
};
Context (please always complete the following information):
- OS: macOSX 10.15.4
- eXist-db version: since the feature was released in 2.2 until latest HEAD (5.3.0-SNAPSHOT)
- Java Version 8
joewiz
Metadata
Metadata
Assignees
Labels
bugissue confirmed as bugissue confirmed as bugdeprecationxqueryissue is related to xquery implementationissue is related to xquery implementation