Skip to content
New issue

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

XQuery functions do not convert their return value to the desired return type #125

Closed
ThomasGravekamp opened this issue May 24, 2019 · 0 comments · Fixed by #145
Closed

Comments

@ThomasGravekamp
Copy link
Contributor

XQuery function should convert the return value of a function to the desired return type as stated in 3.1.5.2 Function Conversion Rules of the XQuery spec.

This can be observed with the following XQuery module:

declare %public function local:test ($node as node()) as xs:string {
	if ($node instance of text()) then
    	$node
    else
    	string($node)
};

let $nodes := //tip | //tip/text()
return $nodes/local:test(.)

In goes a mixed sequence of text() and element() nodes. Only the element nodes are cast explicitly to an xs:string, text nodes are returned as is. Then, the "/" operator starts complaining:

Error: XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.

Playground example

DrRataplan added a commit that referenced this issue Jun 20, 2019
This introduces failing tests because of mistakes in the return value
of some built-in functions...

This will fix #125
DrRataplan added a commit that referenced this issue Jul 25, 2019
Also fix a number of small mistakes regarding different typings:
numeric operators should not always return `xs:decimals`, `fn:name()`
should return an `xs:string?`, etc, etc, etc.

This will fix #125
DrRataplan added a commit that referenced this issue Jul 25, 2019
Also fix a number of small mistakes regarding different typings:
numeric operators should not always return `xs:decimals`, `fn:name()`
should return an `xs:string?`, etc, etc, etc.

Also rerun the QT3 testset reports

This will fix #125
DrRataplan added a commit that referenced this issue Jul 26, 2019
Also fix a number of small mistakes regarding different typings:
numeric operators should not always return `xs:decimals`, `fn:name()`
should return an `xs:string?`, etc, etc, etc.

Also rerun the QT3 testset reports

This will fix #125
DrRataplan added a commit that referenced this issue Jul 26, 2019
Also fix a number of small mistakes regarding different typings:
numeric operators should not always return `xs:decimals`, `fn:name()`
should return an `xs:string?`, etc, etc, etc.

Also rerun the QT3 testset reports

This will fix #125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant