We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
Some variable types might be implicitly cast to strings.
Expected behavior
The XQuery runtime to not implicitly cast to strings where the language specification does not allow it but to raise an error instead.
To Reproduce
xquery version "3.1"; module namespace typetest="http://exist-db.org/xquery/types/test"; declare namespace test="http://exist-db.org/xquery/xqsuite"; declare variable $typetest:implicit-binary := xs:base64Binary("text"); declare variable $typetest:explicit-binary as xs:base64Binary := xs:base64Binary("text"); declare %test:assertError("err:XPTY0004") function typetest:direct-input() { xmldb:encode(xs:base64Binary("text")) }; declare %test:assertError("err:XPTY0004") function typetest:implicitly-typed-module-variable() { xmldb:encode($typetest:implicit-binary) }; declare %test:assertError("err:XPTY0004") function typetest:explicitly-typed-module-variable() { xmldb:encode($typetest:explicit-binary) }; declare %test:assertError("err:XPTY0004") function typetest:implicitly-typed-local-variable() { let $implicit := xs:base64Binary("text") return xmldb:encode($implicit) }; declare %test:assertError("err:XPTY0004") function typetest:explicitly-typed-local-variable() { let $explicit as xs:base64Binary := xs:base64Binary("text") return xmldb:encode($explicit) }; declare %test:assertError("err:XPTY0004") function typetest:implicitly-typed-variable-arrow() { let $implicit := xs:base64Binary("text") return $implicit => xmldb:encode() }; declare %test:assertError("err:XPTY0004") function typetest:explicitly-typed-variable-arrow() { let $explicit as xs:base64Binary := xs:base64Binary("text") return $explicit => xmldb:encode() };
Running the above on exist-db 6.2.0 you'll get (I did not try develop nor develop-6)
<testsuites> <testsuite package="http://exist-db.org/xquery/types/test" timestamp="2024-05-13T14:22:11.717+02:00" tests="7" failures="3" errors="0" pending="0" time="PT0.013S"> <testcase name="direct-input" class="typetest:direct-input"/> <testcase name="explicitly-typed-local-variable" class="typetest:explicitly-typed-local-variable"/> <testcase name="explicitly-typed-module-variable" class="typetest:explicitly-typed-module-variable"/> <testcase name="explicitly-typed-variable-arrow" class="typetest:explicitly-typed-variable-arrow"> <failure message="Expected error err:XPTY0004." type="failure-error-code-1"/> <output>text</output> </testcase> <testcase name="implicitly-typed-local-variable" class="typetest:implicitly-typed-local-variable"> <failure message="Expected error err:XPTY0004." type="failure-error-code-1"/> <output>text</output> </testcase> <testcase name="implicitly-typed-module-variable" class="typetest:implicitly-typed-module-variable"/> <testcase name="implicitly-typed-variable-arrow" class="typetest:implicitly-typed-variable-arrow"> <failure message="Expected error err:XPTY0004." type="failure-error-code-1"/> <output>text</output> </testcase> </testsuite> </testsuites>
Context (please always complete the following information)
Build: eXist-6.2.0 (4d2b1bcdf15cccbc60aa7fd02ade2722a800161d) Java: 1.8.0_402 (Azul Systems, Inc.) OS: Mac OS X 14.4.1 (aarch64)
Additional context
conf.xml
The text was updated successfully, but these errors were encountered:
I just tested this with latest develop (7.0.0-SNAPSHOT). It is fixed there.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Some variable types might be implicitly cast to strings.
Expected behavior
The XQuery runtime to not implicitly cast to strings where the language specification does not allow it but to raise an error instead.
To Reproduce
Running the above on exist-db 6.2.0 you'll get (I did not try develop nor develop-6)
Context (please always complete the following information)
Build: eXist-6.2.0 (4d2b1bcdf15cccbc60aa7fd02ade2722a800161d)
Java: 1.8.0_402 (Azul Systems, Inc.)
OS: Mac OS X 14.4.1 (aarch64)
Additional context
conf.xml
? noneThe text was updated successfully, but these errors were encountered: