[Bug 3841] Static typing of function declarations

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

           Summary: Static typing of function declarations
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: nick@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


According to the Static Type Analysis in section 5.15 of the Formal Semantics:

"The function body's type must be a subtype of the expected return type. If
static typing fails, a static type error is raised."


But 4.15 of the XQuery Language spec states that the rules for converting the
result of a function to its declared result type, are described in 3.1.5
Function Calls, which then proceeds to list a series of atomization and
promotion rules.


The end result is that, by my understanding of the formal semantics, queries
such as

declare function local:myFunction() as xs:float
{
        4.0
};

do not static type check, as 4.0 is xs:decimal, which is not a subtype of
xs:float. Unless I have missed something in the FS, I think the rules from
3.1.5 are missing and need to be added to the formal semantics for function
declarations.

Received on Monday, 16 October 2006 16:11:18 UTC