This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29259 - [QT3TS] subarray() errorcode for test d1e76078
Summary: [QT3TS] subarray() errorcode for test d1e76078
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-03 18:37 UTC by Debbie Lockett
Modified: 2015-12-03 17:29 UTC (History)
2 users (show)

See Also:


Attachments

Description Debbie Lockett 2015-11-03 18:37:36 UTC
The expected error code for the test d1e76078 in test set app-Walmsley has been modified. The test is:
declare variable $array1 := ["abc","def","ghi","jkl"];
 array:subarray($array1,6)

And now expects FOAY0001, rather than FOAY0002. From a strict reading of the spec, I disagree with the change. 

The spec currently says "raise [err:FOAY0001] if $start is less than one"; but it does not say raise this error if $start is greater than array:size($array) (perhaps this is a spec bug??). It says "The two-argument version of the function returns the same result (or the same error) as the three-argument version when called with $length equal to the value of array:size($array) - $start + 1." So in this case, $length is calculated to be -1, and then we get "raise [err:FOAY0002] if $length is less than zero."
Comment 1 Andrew Coleman 2015-12-01 16:35:15 UTC
The WG decided to treat this as a bug against F&O spec
Comment 2 Michael Kay 2015-12-02 16:11:28 UTC
The WG made some disapproving noises about the fact that the test had been changed without consultation.

The WG decided to change the specification of array:subarray() so that FOAY0001 is raised in this case, as expected by the revised test.

The specification has been changed accordingly, and the test results stand.
Comment 3 Debbie Lockett 2015-12-03 17:20:23 UTC
Typo in the spec change. In the amended line:
A dynamic error is raised [err:FOAY0001] if $start is less than one or greater than array:size($array) + 1.

The final "+ 1" is incorrect, it should just be "...or greater than array:size($array)."
Comment 4 Debbie Lockett 2015-12-03 17:25:55 UTC
Sorry, ignore my last comment; the change is correct. $start is allowed to be array:size($array) + 1 to return an empty array.