exist
exist copied to clipboard
[BUG] Predicates on named function references are ignored
Describe the bug
As noted by @alanpaxton in https://github.com/eXist-db/exist/pull/4405, eXist ignores predicates on named function references:
eXist-db at present has no support for predicates on Function References (
NamedFunctionReference.java
) and as such completely ignores the Predicate.
This is likely related to https://github.com/eXist-db/exist/issues/3695.
Expected behavior
eXist should evaluate predicates on function references.
To Reproduce
The expression current-date#0[false()]
should evaluate to an empty sequence. BaseX and Saxon return this result, but eXist unexpectedly returns the function reference.
xquery version "3.1";
module namespace t="http://exist-db.org/xquery/test";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare
%test:assertEmpty
function t:test() {
current-date#0[false()]
};
Screenshots
n/a
Context (please always complete the following information):
- OS: macOS 12.4
- eXist-db version: eXist 6.1.0-SNAPSHOT 5086400a7798dcaf6af849ecc7adbb837412c0b8 20220704154708
- Java Version:
openjdk version "1.8.0_332" OpenJDK Runtime Environment (Temurin)(build 1.8.0_332-b09) OpenJDK 64-Bit Server VM (Temurin)(build 25.332-b09, mixed mode)
Additional context
- How is eXist-db installed? [e.g. JAR installer, DMG, … ] built from source
- Any custom changes in e.g.
conf.xml
? none
Note that current-date#0[false()] => serialize()
triggers an AST bug:
Cannot compile xquery: exerr:ERROR <AST>:0:0: unexpected AST node: Pred [at line 1, column 25]