[Bug 29420] [QT3] K2-SeqSUMFunc-4 and xs:unsignedShort vs xs:integer result

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

--- Comment #4 from Abel Braaksma <abel.braaksma@xs4all.nl> ---
(In reply to Michael Kay from comment #1)
>     $c[1] + fn:sum(subsequence($c, 2))
> 
> and on that basis the test is correct.
I'm not sure it is. We say in 4.2 of FO31:

<quote>
In general the two-argument functions require that both arguments are of the
same primitive type, and they return a value of this same type. 
</quote>

Then the text goes on and explains that the output is one of xs:integer,
xs:float, xs:double, xs:decimal.

I think this makes sense, because otherwise fn:sum(xs:byte(127), xs:byte(127))
would overflow.

If I try it in Saxon, it returns xs:integer. And even when the values are in
range, it still returns xs:integer and not xs:byte.

I would assume this to be the same for any other type: integers and derived
types thereof become xs:integer etc etc.

(In reply to Michael Kay from comment #3)
> The test that does appear to be wrong here is fn-sum-10:
>
> This expects an error. But there should be no error - the specification says
> that the second argument is ignored if the first argument is a non-empty
> sequence.
The test is correct but for another reason: the first argument has an
xs:duration with a Day facet, which is not allowed, it has no additive operand
defined.

One could argue that it does not matter because of the normative function
which, as written, would not call the additive operator. However, I think it
makes sense to allow it to throw.

(In reply to Michael Kay from comment #2)
> were returning 20 rather than 10 for sum((1 to 4), 10).
Ouch, good catch ;).

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

Received on Sunday, 7 February 2016 01:46:15 UTC