<?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>29193</bug_id>
          
          <creation_ts>2015-10-12 15:31:05 +0000</creation_ts>
          <short_desc>[QT3TS] function-call-reserved-function-names-018</short_desc>
          <delta_ts>2015-11-04 15:34:42 +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>Candidate Recommendation</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Debbie Lockett">debbie</reporter>
          <assigned_to name="Tim Mills">tim</assigned_to>
          <cc>josh.spiegel</cc>
    
    <cc>mike</cc>
    
    <cc>oneil</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>123663</commentid>
    <comment_count>0</comment_count>
    <who name="Debbie Lockett">debbie</who>
    <bug_when>2015-10-12 15:31:05 +0000</bug_when>
    <thetext>I believe that error XQST0134 should also be acceptable for the following test in test set prod-FunctionCall:

&lt;test-case name=&quot;function-call-reserved-function-names-018&quot;&gt;
  &lt;description&gt;Check that reserved function name namespace-node is handled correctly. &lt;/description&gt;
  &lt;created by=&quot;Tim Mills&quot; on=&quot;2013-01-24&quot;/&gt;
  &lt;dependency type=&quot;spec&quot; value=&quot;XQ30+&quot;/&gt;
  &lt;test&gt;
	declare default function namespace &quot;http://www.w3.org/2005/xquery-local-functions&quot;;
	declare function local:namespace-node($arg) { fn:true() };
	namespace-node(1)
  &lt;/test&gt;
  &lt;result&gt;
     &lt;error code=&quot;XPST0003&quot; /&gt;
  &lt;/result&gt;
&lt;/test-case&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123672</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2015-10-13 11:59:12 +0000</bug_when>
    <thetext>The test of XQ31 says

&quot;If the axis name is omitted from an axis step, the default axis is child, with two exceptions: (1) if the NodeTest in an axis step contains an AttributeTest or SchemaAttributeTest then the default axis is attribute; (2) if the NodeTest in an axis step is a NamespaceNodeTest then a static error is raised [err:XQST0134].&quot;

Unless I&apos;m mistaken, this test doesn&apos;t use a NamespaceNodeTest, so I&apos;m not sure why XQST0134 would be expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123675</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-10-13 13:13:22 +0000</bug_when>
    <thetext>It&apos;s legitimate for an XPath parser to decide that the only thing namespace-node( can possibly be is the beginning of a NamespaceNodeTest, and then to report an error either because a namespace node test can&apos;t have an integer between the parens, or because a namespace node test is not allowed in the particular circumstances, e.g. when running XPath 2.0 or XQuery 3.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123679</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2015-10-13 15:06:25 +0000</bug_when>
    <thetext>I&apos;m afraid I don&apos;t agree.  I think you have to perform the look-ahead to differentiate between namespace-node() and namespace-node(1).  

From your argument, it would seem that you would permit XQST0134 for a syntactically incorrect query such as

namespace-node(!

One for the WG I suspect.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123681</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-10-13 15:49:52 +0000</bug_when>
    <thetext>I don&apos;t think there&apos;s anything in the spec that says you have to have a syntactically valid parse before you can raise a &quot;semantic&quot; error. For example, as soon as I&apos;ve read &quot;x:something(&quot; then I know this can only legitimately be the start of a function call, so I&apos;m allowed to check whether &quot;x&quot; is an in-scope prefix before checking that what follows is a syntactically-legitimate continuation of the function call.

The spec says &quot;If more than one error is present, or if an error condition comes within the scope of more than one error defined in this specification, then any non-empty subset of these errors may be reported.&quot; We very deliberately give implementations freedom in terms of the order of processing when doing static analysis. Here there are (on some interpretation) two errors, a spurious &quot;1&quot; between the parens of a namespace-node test, and use of a namespace-node test in a version of the language where it isn&apos;t allowed, and the processor is allowed to report either or both of those.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123682</commentid>
    <comment_count>5</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2015-10-13 16:10:56 +0000</bug_when>
    <thetext>I take your point, but I&apos;m afraid I can&apos;t agree that this test uses a NamespaceNodeTest.  At best XQST0134 is confusing, and at worst it is wrong.

Perhaps it should be discussed in the WG, but if not, I&apos;ll leave it to you to change the expected results.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123684</commentid>
    <comment_count>6</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2015-10-13 16:34:04 +0000</bug_when>
    <thetext>I think XPST0003 is the correct result and I am not sure about the justification of XQST0134.  But since both are static errors and the argument in Comment 4 is at least plausible, I don&apos;t think there is much harm allowing both.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123685</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-10-13 16:35:09 +0000</bug_when>
    <thetext>I would argue for the widest possible interpretation of the rules here. If a user writes the query

processing=instruction()

there are two possible interpretations:

(a) they are doing a comparison between an element called &quot;processing&quot; and the result of a non-existent function called &quot;instruction&quot;

(b) they have mistyped &quot;-&quot; as &quot;=&quot;

A processor that reports (b) has probably guessed correctly what the real problem is, and we should certainly not require it to report the error as (a). A well-designed processor reports static errors that correctly guess what the user did wrong.

If we encountered namespace-node(1) in a real query, my guess would be that the user has made two errors: they have used namespace-node in a dialect of the language where it isn&apos;t allowed, and they have given it a parameter that it doesn&apos;t accept. In an ideal world I would want to report both of those errors. The first one is more useful to report, because if they correct the second they still won&apos;t have a valid query. The spec allows me, however, to report any subset.

I don&apos;t think we should be making a hard-and-fast distinction here between syntax errors and semantic errors. From a user perspective, the fact that text(3) is a syntax error while position(3) is a semantic error is not a meaningful distinction: we drew the boundary for our convenience, not for the user&apos;s benefit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124080</commentid>
    <comment_count>8</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2015-11-04 15:34:42 +0000</bug_when>
    <thetext>I have made the fix of adding the error code XQST0134 to the test case as suggested in comment #0. Please reopen if anyone objects.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>