W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2007

[Bug 5288] [XQuery] XPST0005 and conditinoal expressions

From: <bugzilla@wiggum.w3.org>
Date: Tue, 27 Nov 2007 13:19:00 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1Ix0L6-0004oX-JN@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5288

           Summary: [XQuery] XPST0005 and conditinoal expressions
           Product: XPath / XQuery / XSLFO / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


err:XPST0005 is defined in XQuery as

    During the analysis phase, it is a static error if the static type assigned
to an expression other than the expression () or data(()) is empty-sequence().

Consider the expression:

if (...)
then ()
else fn:error('err:MyError')

The static type of this expression is empty-sequence(), which is the union of
'none' and 'empty-sequence()', as noted in paragraph 2 of 

http://www.w3.org/TR/xquery-semantics/#sec_content_models

According to the definition of XPST0005, this should raise XPST0005 at static
type checking, rather than possibly calling fn:error at run time.  A suitably
constructed typeswitch could also exhibit this behaviour.  Is this intentional?
 A glance at the XQuery Update Facility shows that this is a problem here too,
as the updating operations have static type empty-sequence().

I note that this error is only ever tested in XQTS when a step in a path
expression is found to be empty-sequence() (a case specifically mentioned in
the XQuery specification).  Other than the cases mentioned above, I think it
may also be thrown during static type checking of 'for', 'for/at', 'let',
variable references and function calls.  

Since implementations are allowed to use static type checking extensions (which
might infer a static type of empty-sequence() when the standard rules cannot),
testing of this error code could be quite tricky.
Received on Tuesday, 27 November 2007 13:19:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:21 GMT