<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27180</bug_id>
          
          <creation_ts>2014-10-27 20:11:13 +0000</creation_ts>
          <short_desc>Various minor bugs and inconsistencies</short_desc>
          <delta_ts>2015-07-13 20:32:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 3 &amp; XPath 3 Test Suite</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>28944</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Christian Gruen">christian.gruen</reporter>
          <assigned_to name="O&apos;Neil Delpratt">oneil</assigned_to>
          <cc>botond23</cc>
    
    <cc>mike</cc>
    
    <cc>tim</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>113799</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-10-27 20:11:13 +0000</bug_when>
    <thetext>* fn-data-7
  Result: FOTY0012
  Expecting FOTY0013 → The argument to fn:data() contains a function item.

* K-ErrorFunc-4, XPTY0004_12
  Result: XPTY0004
  Since XQuery 3.1: FOER0000 (single argument of fn:error can be empty sequence)

* K-TokenizeFunc-1
  Result: XPST0017
  Since XQuery 3.1: tokenize() also accepts a single argument

* K-TraceFunc-2
  Result: XPST0017
  Since XQuery 3.1: trace() also accepts a single argument

* map-size-007, map-keys-007, map-for-each-007
  Expecting XQDY0137 (key was defined more than once)

* cbcl-castable-long-001, cbcl-castable-long-002, cbcl-castable-unsignedLong-001
  Expecting FOAR0002 (Overflow/underflow; additionally to existing result)

* UCA-collation-009 (...hiraganaQuaternary=unknown)
  Note: may need to be removed (see bug 27178)

* UCA-collation-022 (...version=7.0)
  Result: FOCH0002
  Expecting no error, as version 7.0 is already published

* The following test have &quot;XQ30&quot; as dependency. It should probably be &quot;XQ30+&quot;:

  K2-DirectConElem-53a
  K-FunctionCallExpr-15a
  K-InternalVariablesWith-16a
  K-InternalVariablesWith-17a
  K-InternalVariablesWith-18a
  K-InternalVariablesWith-19a
  K-InternalVariablesWith-20a
  K2-VersionProlog-3-v3
  version_declaration-022-v3
  VersionDecl-v3-processor-and-v1-query
  version_declaration-010-v3
  K-VersionProlog-3-v3
  K-VersionProlog-4-v3
  K-VersionProlog-2-v3
  prolog-version-4-v3
  prolog-version-5-v3
  prolog-version-6-v3
  prolog-version-7-v3
  prolog-version-1-v3
  prolog-version-3-v3
  K-VersionProlog-5-v3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116265</commentid>
    <comment_count>1</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-12-13 17:43:32 +0000</bug_when>
    <thetext>* ArrayTest-012, ArrayTest-013, ArrayTest-014, ArrayTest-024, ArrayTest-026
  Result: XPDY0138, XPTY0004
  Expecting FOAY0001</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116266</commentid>
    <comment_count>2</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-12-13 18:32:45 +0000</bug_when>
    <thetext>* xs-numeric-021, xs-numeric-022
  Schema dependency is missing:
  &lt;dependency type=&quot;feature&quot; value=&quot;schemaImport&quot;/&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116276</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-12-14 09:12:38 +0000</bug_when>
    <thetext>Re comment 1, the WG made a decision to unify the error code for &quot;array index out of bounds&quot;, though I don&apos;t see that implemented yet in the spec.

Re comment 2, we assume an implicit dependency on schema-awareness if the environment uses a schema, but I can&apos;t see anything in the test suite documentation to justify that, so I&apos;ll make it explicit.

Generally, please try to avoid portmanteau bugs. It makes it harder to track the problems to a resolution. We don&apos;t count the number of bugs, and integers are not a scarce resource.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116277</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-12-14 09:23:21 +0000</bug_when>
    <thetext>Note re comment 2, the actual dependency is on SchemaValidation, not SchemaImport.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116278</commentid>
    <comment_count>5</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-12-14 12:13:47 +0000</bug_when>
    <thetext>&gt; Generally, please try to avoid portmanteau bugs. It makes it harder to track the problems to a resolution. We don&apos;t count the number of bugs, and integers are not a scarce resource.

;) Thanks for the advice, Michael (I didn&apos;t expect any discussion to evolve on the issues at all). Is it ok to create one entry for all those minor observations, or would you prefer to have many small bug entries?

I have enumerated the existing entries below:

1. fn-data-7
   Result: FOTY0012
   Expecting FOTY0013 → The argument to fn:data() contains a function item.

2. K-ErrorFunc-4, XPTY0004_12
   Result: XPTY0004
   Since XQuery 3.1: FOER0000 (single argument of fn:error can be empty sequence)

3. K-TokenizeFunc-1
  Result: XPST0017
  Since XQuery 3.1: tokenize() also accepts a single argument

4. K-TraceFunc-2
   Result: XPST0017
   Since XQuery 3.1: trace() also accepts a single argument

5. map-size-007, map-keys-007, map-for-each-007
   Expecting XQDY0137 (key was defined more than once)

6. cbcl-castable-long-001, cbcl-castable-long-002, cbcl-castable-unsignedLong-001
   Expecting FOAR0002 (Overflow/underflow; additionally to existing result)

7. UCA-collation-009 (...hiraganaQuaternary=unknown)
   Note: may need to be removed (see bug 27178)

8. UCA-collation-022 (...version=7.0)
   Result: FOCH0002
   Expecting no error, as version 7.0 is already published

9. The following test have &quot;XQ30&quot; as dependency. It should probably be &quot;XQ30+&quot;:

   K2-DirectConElem-53a
   K-FunctionCallExpr-15a
   K-InternalVariablesWith-16a
   K-InternalVariablesWith-17a
   K-InternalVariablesWith-18a
   K-InternalVariablesWith-19a
   K-InternalVariablesWith-20a
   K2-VersionProlog-3-v3
   version_declaration-022-v3
   VersionDecl-v3-processor-and-v1-query
   version_declaration-010-v3
   K-VersionProlog-3-v3
   K-VersionProlog-4-v3
   K-VersionProlog-2-v3
   prolog-version-4-v3
   prolog-version-5-v3
   prolog-version-6-v3
   prolog-version-7-v3
   prolog-version-1-v3
   prolog-version-3-v3
   K-VersionProlog-5-v3

comment 1:

10. ArrayTest-012, ArrayTest-013, ArrayTest-014, ArrayTest-024, ArrayTest-026
    Result: XPDY0138, XPTY0004
    Expecting FOAY0001

comment 2:

11. xs-numeric-021, xs-numeric-022
    Schema dependency is missing:
    &lt;dependency type=&quot;feature&quot; value=&quot;schemaImport&quot;/&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116281</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-12-14 21:28:54 +0000</bug_when>
    <thetext>Even when there&apos;s no discussion needed, different problems might be clsoed at different times.

If it&apos;s the same problem in a group of related tests, that are likely to be fixed by the same person at the same time, feel free to use a single bug. For unrelated problems in unrelated tests, it&apos;s better to raise multiple bugs, so they can be assigned to different people and closed at different times.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116376</commentid>
    <comment_count>7</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2014-12-16 13:07:33 +0000</bug_when>
    <thetext>Test cases fixed according comment #5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116495</commentid>
    <comment_count>8</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-12-18 15:34:41 +0000</bug_when>
    <thetext>The change requested to tests cbcl-castable-long-001, cbcl-castable-long-002, and cbcl-castable-unsignedLong-001 was to add an additional error code.

However, O&apos;Neil appears to have replaced FORG0001 with FOAR0002.  Please correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116526</commentid>
    <comment_count>9</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2014-12-18 23:00:16 +0000</bug_when>
    <thetext>Correction made according to comment 8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116548</commentid>
    <comment_count>10</comment_count>
    <who name="Botond Biró">botond23</who>
    <bug_when>2014-12-19 09:29:56 +0000</bug_when>
    <thetext>(In reply to O&apos;Neil Delpratt from comment #9)
&gt; Correction made according to comment 8

I think for the testcases cbcl-castable-long-001, cbcl-castable-long-002, cbcl-castable-unsignedLong-001 the changes were incorrect - the expected result should be assert-false and not the overflow error.
In my understanding, the castable as expressions should not fail if the lhs expression was evaluated successfully.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116549</commentid>
    <comment_count>11</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-12-19 09:38:55 +0000</bug_when>
    <thetext>(In reply to Botond Biró from comment #10)
&gt; (In reply to O&apos;Neil Delpratt from comment #9)
&gt; &gt; Correction made according to comment 8
&gt; 
&gt; I think for the testcases cbcl-castable-long-001, cbcl-castable-long-002,
&gt; cbcl-castable-unsignedLong-001 the changes were incorrect - the expected
&gt; result should be assert-false and not the overflow error.
&gt; In my understanding, the castable as expressions should not fail if the lhs
&gt; expression was evaluated successfully.

I agree.  Prior to the change, the test expected only false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116554</commentid>
    <comment_count>12</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-12-19 13:56:52 +0000</bug_when>
    <thetext>I think this is the correct result for the three cases:

  &lt;result&gt;
    &lt;any-of&gt;
      &lt;assert-false/&gt;
      &lt;error code=&quot;FOAR0002&quot;/&gt;
    &lt;/any-of&gt;
  &lt;/result&gt;

Tim wrote in Comment 8:

&gt; However, O&apos;Neil appears to have replaced FORG0001 with FOAR0002.

Were you supposed to say &quot;assert-false&quot; instead of &quot;FORG0001&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116555</commentid>
    <comment_count>13</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-12-19 14:14:34 +0000</bug_when>
    <thetext>(In reply to Christian Gruen from comment #12)
&gt; I think this is the correct result for the three cases:
&gt; 
&gt;   &lt;result&gt;
&gt;     &lt;any-of&gt;
&gt;       &lt;assert-false/&gt;
&gt;       &lt;error code=&quot;FOAR0002&quot;/&gt;
&gt;     &lt;/any-of&gt;
&gt;   &lt;/result&gt;
&gt; 
&gt; Tim wrote in Comment 8:
&gt; 
&gt; &gt; However, O&apos;Neil appears to have replaced FORG0001 with FOAR0002.
&gt; 
&gt; Were you supposed to say &quot;assert-false&quot; instead of &quot;FORG0001&quot;?

Yes.  FORG0001 is the error cast would raise

I&apos;m not entirely certain why you&apos;d expect FOAR0002.  If the large integer value is too big for your internal representation of a decimal value, I&apos;d have expected you to raise FOCA0001, but it&apos;s probably arguable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116558</commentid>
    <comment_count>14</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2014-12-19 15:30:46 +0000</bug_when>
    <thetext>&gt; I&apos;m not entirely certain why you&apos;d expect FOAR0002. If the large integer value
&gt; is too big for your internal representation of a decimal value, I&apos;d have
&gt; expected you to raise FOCA0001, but it&apos;s probably arguable.

As the description for FOCA0001 is &quot;Input value too large for decimal.&quot;, I am not sure if this would be the best choice, as the input is an integer (we have no problem to represent larger decimals). We chose FOAR0002 based on the interpretation of the spec shown below. Maybe a parse error (XQST) could be more appropriate, but in practice, it has not been an issue so far:

* [1] &quot;The value of a numeric literal containing no &quot;.&quot; and no e or E character is
  an atomic value of type xs:integer. [...] The value of the numeric literal is
  determined by casting it to the appropriate type according to the rules for
  casting from xs:untypedAtomic to a numeric type as specified in Section
  19.2 Casting from xs:string and xs:untypedAtomic FO31.&quot;

* [2] &quot;If the value is too large or too small to be accurately represented by the
  implementation, it is handled as an overflow or underflow as defined in
  4.2 Arithmetic operators on numeric values.&quot;

* [3] &quot;For xs:integer operations, implementations that support limited-precision 
  integer operations ·must· select from the following options: They ·may· choose
  to always raise a dynamic error [err:FOAR0002].&quot;

[1] http://www.w3.org/TR/xquery-31/#id-literals
[2] http://www.w3.org/TR/xpath-functions-31/#casting-from-strings
[3] http://www.w3.org/TR/xpath-functions-31/#op.numeric</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116562</commentid>
    <comment_count>15</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-12-19 17:15:42 +0000</bug_when>
    <thetext>(In reply to Christian Gruen from comment #14)

I agree with Christian&apos;s reading of the spec here. I think the only legitimate outcomes are false (if the implementation can handle integers this large), and FOAR0002 (if it can&apos;t). For the second case, the failure occurs when constructing the integer literal, which uses the rules for casting string to integer; the failure is while evaluating the lhs of the &quot;castable&quot; expression, and such a failure throws the error rather than returning false.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116594</commentid>
    <comment_count>16</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-12-19 23:40:41 +0000</bug_when>
    <thetext>Another comment here, it&apos;s a wrong approach to read the list of error codes and see which one has the best-fit description. The descriptions are often hopelessly generic (e.g. err:FORG0006, Invalid argument type.). You have to work from the rules for the construct in question. Here I started with the rules in the XPath/XQuery book for numeric literals, which takes you to F+O 19.1.2.4 (casting to xs:integer) which takes you to 19.2 (casting from xs:string), which takes you to

If the value is too large or too small to be accurately represented by the implementation, it is handled as an overflow or underflow as defined in 4.2 Arithmetic operators on numeric values.

and 4.2 has

For xs:integer operations, implementations that support limited-precision integer operations ·must· select from the following options:
They ·may· choose to always raise a dynamic error [err:FOAR0002].
They ·may· provide an ·implementation-defined· mechanism that allows users to choose between raising an error and returning a result that is modulo the largest representable integer value. See [ISO 10967].

An implementor who wants to take the second option could challenge the test on those grounds (it would give a result of &quot;true&quot;!), but no-one has done so; the only other option, if you don&apos;t support an integer of this size, seems to be FOAR0002.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116641</commentid>
    <comment_count>17</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2014-12-22 11:03:04 +0000</bug_when>
    <thetext>(In reply to Christian Gruen from comment #12)
&gt; I think this is the correct result for the three cases:
&gt; 
&gt;   &lt;result&gt;
&gt;     &lt;any-of&gt;
&gt;       &lt;assert-false/&gt;
&gt;       &lt;error code=&quot;FOAR0002&quot;/&gt;
&gt;     &lt;/any-of&gt;
&gt;   &lt;/result&gt;
&gt; 

If there are no objections I think I will follow what is said in comment #12 as the expected result. From the reasoning of Mike&apos;s comment #15 and #16 I did follow it through in the spec and I agree it seems to me the correct resolution to this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116643</commentid>
    <comment_count>18</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2014-12-22 15:42:38 +0000</bug_when>
    <thetext>Bug fix applied to the test cases cbcl-castable-long-001, cbcl-castable-long-002, cbcl-castable-unsignedLong-001 as suggested</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117297</commentid>
    <comment_count>19</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-01-18 10:43:34 +0000</bug_when>
    <thetext>I have reopened this bug report due to a minor issue: in XPTY0004_12 and XPTY0004_12a, the dependencies were not added yet:

  &lt;dependency type=&quot;spec&quot; value=&quot;XQ10 XP20 XQ30 XP30&quot; /&gt;

  &lt;dependency type=&quot;spec&quot; value=&quot;XQ31+ XP31+&quot; /&gt; 

This is the original commit: https://github.com/LeoWoerteler/QT3TS/commit/eb79da906c8875de97245a27cb7c44a5918dfc72#diff-25b65cb2a523b0b6045d4fd2020efe13L1451</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117303</commentid>
    <comment_count>20</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-01-19 09:23:12 +0000</bug_when>
    <thetext>Fixed by myself.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>