[Bug 1431] [FO/FS] Constrain $zero to be compatible if static typing is available

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


simeon@us.ibm.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From simeon@us.ibm.com  2005-07-19 20:57 -------
This is certainly possible. Here is the revised static typing rule
which achieves Mihael's proposed semantics.

statEnv |- Expr1 : Type1
statEnv |- Expr2 : Type2
statEnv |- Type2 <: xdt:anyAtomicType ?
Type3 = prime(Type1)
Type4 = convert_untypedAtomic(Type3, xs:double)
ItemType1, ...,ItemTypen = Type4
Type0 in { xs:integer, xs:decimal, xs:float, xs:double, xdt:yearMonthDuration }
statEnv |- ItemTypei can be promoted to Type0      1 <= i <= n
statEnv |- Type2 <: Type0
--------------------------------------------------------------------------------
statEnv |- fn:sum(Expr1,Expr2) : Type0 · aggregate_quantifier(quantifier(Type1))

Note that the resulting type does not need a union anymore which is nice.

Note also that this will always reject cases where the user writes:

fn:sum(//somedates)

since this will be normalized to

fn:sum(//somedates,0)

and 0 is not a date...

- Jerome

Received on Tuesday, 19 July 2005 20:57:27 UTC