[Bug 5459] [FS] Static type analysis for the fn:abs, fn:ceiling, fn:floor, fn:round, and fn:round-half-to-even functions

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





--- Comment #20 from Oliver Hallam <oliver@cbcl.co.uk>  2008-07-31 14:22:37 ---
These type checking rules agree with our implementation except your definition
of base atomic type for xs:dayTimeDuration and xs:yearMonthDuration is
xs:duration and so for example the following (quite reasonable) query would
fail to type check.:

min(sum(A), sum(B))

where A and B produce sequences of one or more xs:dayTimeDurations.

Since we already have the exception for xs:integer, I see no reason not to
extend this to exceptions for xs:dayTimeDuration and xs:yearMonthDuration; that
is I suggest altering the rules as follows:

    If Type1 is (or is a subtype of) any primitive atomic type other than
    xs:decimal or xs:duration, then that is its base atomic type.

        Type1 <: Type2
        Type2 is a primitive atomic type
        not(Type2 in { xs:decimal, xs:duration })
        --------------
        Type1 has base atomic type Type2

    Similarly for xs:integer, xs:dayTimeDuration and xs:yearMonthDuration
    (which aren't primitive).

        Type1 <: Type2
        Type2 in { xs:integer, xs:dayTimeDuration, xs:yearMonthDuration }
        --------------
        Type1 has base atomic type Type2

    Finally, the special case for xs:decimal:
        Type1 <: xs:decimal
        not( Type1 <: xs:integer )
        --------------
        Type1 has base atomic type xs:decimal

    and for xs:duration:
        Type1 <: xs:duration
        not( Type1 <: xs:yearMonthDuration )
        not( Type1 <: xs:dayTimeDuration )
        --------------
        Type1 has base atomic type xs:duration

Although the last rule is only for completeness and is never applied.


If the concept of base atomic type is being added anyway, then is it worth
using it in place of base numeric type for abs, etc. ?


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 31 July 2008 14:23:12 UTC