[Bug 29430] [FO31] Resulting type of numeric functions

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

--- Comment #1 from Michael Kay <mike@saxonica.com> ---
There are missing parentheses in your examples but I assume the intended
expressions are

   fn:sum((xs:byte(1), xs:byte(2)))
   fn:sum((xs:unsignedShort(12), xs:unsignedShort(24)))
   fn:sum((xs:nonNegativeInteger(42), xs:nonNegativeInteger(42)))

that is, in each case we are concerned with sum#1 rather than sum#2.

>My take is that, since fn:sum is defined in terms of op:numeric-plus, section 4.2 applies and they should all return xs:integer. That does not prevent them from return xs:byte, xs:unsignedShort, xs:nonNegativeInteger, 

I agree with that.

>Michael Kay argues in bug 29240, comment#5 that the rules in section 4.2 do not apply for fn:sum, but I think they do.

I was arguing that the rules in section 4.2 do not apply to fn:sum() when the
first argument to fn:sum is a singleton, because in that case op:numeric-plus
is not invoked. The rules for fn:sum say that when the first argument is a
singleton, it is returned unchanged.

>Considering the confusion this caused

Personally I think fn:sum is quite wordy enough already, and that saying the
same thing in three different ways does not always add clarity.

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

Received on Thursday, 11 February 2016 22:18:09 UTC