<?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>7036</bug_id>
          
          <creation_ts>2009-06-21 03:48:15 +0000</creation_ts>
          <short_desc>bug in test case K2-NameTest-84 ?</short_desc>
          <delta_ts>2010-03-15 12:26:30 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Query Test Suite</product>
          <component>XML Query Test Suite</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bogdan Butnaru">bogdanb+w3c+bugzilla</reporter>
          <assigned_to name="Frans Englich">frans.englich</assigned_to>
          <cc>andrew.eisenberg</cc>
    
    <cc>jmdyck</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>25624</commentid>
    <comment_count>0</comment_count>
    <who name="Bogdan Butnaru">bogdanb+w3c+bugzilla</who>
    <bug_when>2009-06-21 03:48:15 +0000</bug_when>
    <thetext>Hello! I&apos;m using a version of the test suite taken from the CVS about a week ago. I might be misusing it, I apologize if that&apos;s the case.

Test case “K2-NameTest-84” (in cat/NameTest.xml) reads:

(:*******************************************************:)
(: Test: K2-NameTest-84                                  :)
(: Written by: Frans Englich                             :)
(: Date: 2007-11-22T11:31:21+01:00                       :)
(: Purpose: Axis names are reserved function names.      :)
(:*******************************************************:)
declare default function namespace &quot;http://www.example.com/&quot;;
    declare function element()
    {
    1
    };
    element()
(: end test case quote :)

The test case expects the error XPST0003 (i.e., the expression is not a valid instance of the XQuery grammar), but does not cite any spec for that. I fail to find anything relevant in both the XQuery 1.0 and 1.1 (draft) specs.

As far as I can tell, Appendix 3 “Reserved Function Names” (in both specs) refers only to function calls. Furthermore, it does not actually specify an interdiction but an impossibility: it only disambiguates the grammar, which is why there is no error code given.

Production “FunctionDecl” (number 26 in 1.0 and 32 in 1.1) doesn&apos;t have the “reserved-function-names” annotation. The extra-grammatical constraint specifies that “it is not legal syntax for a user to invoke functions with unprefixed names which match any of the names in A.3”. (Note that this specifically says “invoking”, not “declaring”, a function.)

By my reading, the query above defines the function “element” in namespace “http://www.example.com”, and then goes on and returns the value of “./child::element()” (i.e., the body is a PathExpr consisting of a single AbbrevForwardStep with an ElementTest).

The correct error code would be XPDY0002, since the context element is not defined; however, one supposes that&apos;s not what the test case attempts to test. The syntax error expected could only arise if the function&apos;s arity would be greater than zero, and it were called with an argument that is not a QName.

Note that while the function cannot be called in the test case as written, a function declared with an unprefixed but reserved name can actually called, for instance as below:

(: example :)
declare default function namespace &quot;http://www.example.com/&quot;;
declare namespace NS = &quot;http://www.example.com/&quot;;
declare function element() { 1 };
NS:element()
(: end example :)

I suggest to change the test to the following:

(: suggestion :)
declare default function namespace &quot;http://www.example.com/&quot;;
declare function element($arg) { $arg };
element(1)
(: end example :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28341</commentid>
    <comment_count>1</comment_count>
    <who name="Frans Englich">frans.englich</who>
    <bug_when>2009-10-14 13:54:41 +0000</bug_when>
    <thetext>I think you&apos;re right actually. Saxon, QtXmlPatterns(implemented by me), and X-Hive disagrees with your interpretation, but considering that reserved-function-names doesn&apos;t apply to FunctionDecl as you point out, I agree.

Mike, you got an objection or have Bogdan found a slew of (minor) bugs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28342</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-10-14 14:03:34 +0000</bug_when>
    <thetext>Yes, I suspect Bogdan&apos;s reasoning is correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28345</commentid>
    <comment_count>3</comment_count>
    <who name="Frans Englich">frans.englich</who>
    <bug_when>2009-10-14 14:29:56 +0000</bug_when>
    <thetext>This should be fixed in CVS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>28394</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2009-10-16 13:41:47 +0000</bug_when>
    <thetext>In the XQTS catalog file for this test (NameText.xml), the scenario for this test is still parse-error, so needs fixing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29977</commentid>
    <comment_count>5</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2009-12-08 00:02:45 +0000</bug_when>
    <thetext>I agree with Tim in comment #5. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30945</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2010-01-11 22:11:29 +0000</bug_when>
    <thetext>See also bug #8713. I think the spec needs clarifying: there&apos;s nothing in App.3 that says it refers only to function calls and not to function declarations, though there is circumstantial evidence elsewhere that that was intended. I don&apos;t really care much which way the decision goes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32218</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2010-02-17 01:00:41 +0000</bug_when>
    <thetext>According to Bug 8713 comment #3, &quot;Our intent in 1.0 was to disallow such names in both function declarations and invocations. We will revise the 1.0 tests to allow either error or success.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33587</commentid>
    <comment_count>8</comment_count>
    <who name="Frans Englich">frans.englich</who>
    <bug_when>2010-03-15 12:26:30 +0000</bug_when>
    <thetext>XPST0003 added as baseline in CVS.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>