[Bug 29119] [XP31] xs:error always raises a type error

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29119

Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike@saxonica.com

--- Comment #7 from Michael Kay <mike@saxonica.com> ---
"...to say that xs:error, used as a SequenceType, is always a type error"

That would make

12 instance of xs:error

a type error, which can't possibly be right: it's a perfectly valid expression
that returns false.

The essence of xs:error is that it's a type with no instances. That should be
enough to answer all questions about it. It shouldn't get any special
treatment. From this simple fact, everything else follows without any special
rules:

$x instance of xs:error --> always returns false

$x cast as xs:error --> fails dynamically with FORG0001 for all possible values
of $x

$x cast as xs:error? --> succeeds if empty($x), fails FORG0001 for all other
values of $x

xs:error($x) --> same as ($x cast as xs:error?)

$x castable as xs:error --> always returns false

$x treat as xs:error --> fails with dynamic error XPDY0050 if evaluated. Never
fails statically. 

declare variable $x as xs:error --> fails with type error XPTY0004 (the
processor has the option to raise the error statically or dynamically, or to
avoid raising the error if $x is not used)

let $x as xs:error := $y return EXPR --> ditto.

declare function f($arg as xs:error) {...} --> a legitimate function
declaration; any call to the function (but see §1) fails with a type error
XPTY0004, which may be raised statically or dynamically. If there is no
function call, there is no error.

§1 - other than a call with an argument whose static type is xs:error, e.g.
f($x treat as xs:error), which fails XPDY0050 if and when the argument is
evaluated.

Historically, it's my belief that 2.5.7 was intended to explain this, and
failed to do so adequately. 2.5.7 should be treated as non-normative - it
doesn't say anything that you couldn't work out for yourself.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 6 October 2015 08:11:01 UTC