<?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>15999</bug_id>
          
          <creation_ts>2012-02-16 12:47:31 +0000</creation_ts>
          <short_desc>[QT3TS] hof-039</short_desc>
          <delta_ts>2013-03-14 12:02:11 +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>Member-only Editors Drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</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="Tim Mills">tim</reporter>
          <assigned_to name="Jim Melton">jim.melton</assigned_to>
          <cc>jim.melton</cc>
    
    <cc>jonathan.robie</cc>
    
    <cc>oneil</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>64163</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-02-16 12:47:31 +0000</bug_when>
    <thetext>I disagree with the expected result for this test.

The part of this which I disagree with is the following instance of test.

declare function local:f($x as xs:long, $y as xs:NCName) as element(e)?
{ &lt;e x=&quot;{$x}&quot; y=&quot;{$y}&quot;/&gt; };

local:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType)*,

The expected result (for this part of the test) is true .  I believe it should be false.

The function declaration has return type element(e)?.  Refering to the Formal Semantics specification, this expends out to:

[element(e)?]sequencetype
==
(element e nillable of type xs:anyType)?

Expading out the return type from the function type being tested, we get:

[element(e,xs:anyType)*]sequencetype
==
(element e of type xs:anyType)*

Note the absense of nillable.

Changing the test to:

local:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType?)*

would cause the actual and expected results to agree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67849</commentid>
    <comment_count>1</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-05-18 10:18:21 +0000</bug_when>
    <thetext>John you are the expert on this one, please can you adjudicate</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67851</commentid>
    <comment_count>2</comment_count>
    <who name="John Snelson">john.snelson</who>
    <bug_when>2012-05-18 10:33:10 +0000</bug_when>
    <thetext>SequenceType matching in the spec says:

http://www.w3.org/TR/xquery-30/#id-element-test

2. element( ElementName ) matches any element node whose name is ElementName, regardless of its type annotation or nilled property.

3. element( ElementName , TypeName ) matches an element node whose name is ElementName if derives-from( AT, TypeName ) is true, where AT is the type annotation of the element node, and the nilled property of the node is false.

This seems to agree with Tim&apos;s analysis.


The SequenceType-subtype judgement says:

http://www.w3.org/TR/xquery-30/#id-itemtype-subtype

12. Bi is either element(Bn) or element(Bn, xs:anyType), the expanded QName of An equals the expanded QName of Bn, and Ai is either element(An), or element(An, T) for any type T.

This seems to contradict SequenceType matching, and is therefore wrong.



I agree with Tim&apos;s test change, but also think that the XQuery 3.0 spec, section 2.5.6.2, list item 12 should be changed to:

Bi is either element(Bn) or element(Bn, xs:anyType?), the expanded QName of An equals the expanded QName of Bn, and Ai is either element(An), element(An, T), or element(An,T?) for any type T.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68247</commentid>
    <comment_count>3</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-05-29 10:03:25 +0000</bug_when>
    <thetext>We require WG discussion on this bug issue</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68268</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-05-29 15:41:59 +0000</bug_when>
    <thetext>The Working Group has agreed to change point 12 of:

http://www.w3.org/TR/xquery-30/#id-itemtype-subtype

To:

12. Bi is either element(Bn) or element(Bn, xs:anyType?), the expanded QName 
of An equals the expanded QName of Bn, and Ai is either element(An), 
element(An, T), or element(An,T?) for any type T.

The test suite still needs to be updated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69111</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-06-15 22:33:34 +0000</bug_when>
    <thetext>The resolution in Comment #4 seems wrong.

Instead of this:

12.  Bi is either element(Bn) or element(Bn, xs:anyType?), the expanded QName of An equals the expanded QName of Bn, and Ai is either element(An), &lt;lookhere&gt;element(An, T), or element(An,T?)&lt;/lookhere&gt; for any type T.

Shouldn&apos;t it be this?


12.  Bi is either element(Bn) or element(Bn, xs:anyType?), the expanded QName of An equals the expanded QName of Bn, and Ai is either element(An), &lt;lookhere&gt;element(An), or element(An,T?)&lt;/lookhere&gt; for any type T.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74924</commentid>
    <comment_count>6</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2012-10-01 13:55:36 +0000</bug_when>
    <thetext>Test case result updated to agree with the suggested change in comment #0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75048</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-10-02 13:40:51 +0000</bug_when>
    <thetext>I still don&apos;t agree with the expected result.

It&apos;s possible to determine that

declare function local:f($x as xs:long, $y as xs:NCName) as element(e)?
{ &lt;e x=&quot;{$x}&quot; y=&quot;{$y}&quot;/&gt; };

will always return an element(e).  Thus this is equivalent to 

declare function local:f($x as xs:long, $y as xs:NCName) as element(e)
{ &lt;e x=&quot;{$x}&quot; y=&quot;{$y}&quot;/&gt; };

and so the result can be

&quot;true true true true true true true true true false&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83725</commentid>
    <comment_count>8</comment_count>
      <attachid>1327</attachid>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-02-26 14:41:40 +0000</bug_when>
    <thetext>Created attachment 1327
Discussion document</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84404</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-03-14 12:02:01 +0000</bug_when>
    <thetext>This was discussed in XML Query/XSL WG Joint Teleconference #531 Minutes 2013-02-26.  The test suite was updated accordingly.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1327</attachid>
            <date>2013-02-26 14:41:40 +0000</date>
            <delta_ts>2013-02-26 14:41:40 +0000</delta_ts>
            <desc>Discussion document</desc>
            <filename>hof.htm</filename>
            <type>text/html</type>
            <size>3689</size>
            <attacher name="Tim Mills">tim</attacher>
            
              <data encoding="base64">PGh0bWw+DQogIDxoZWFkPg0KICAgIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQogICAgZGl2IHsg
Ym9yZGVyOiAxcHggc29saWQgIzg4ODsgbWFyZ2luOiAxZW07IHBhZGRpbmc6IDAuMjVlbTsgfQ0K
ICAgIDwvc3R5bGU+DQogIDwvaGVhZD4NCiAgPGJvZHk+DQogICAgPGgxPmhvZi0wMzk8L2gxPg0K
PHByZT4NCmRlY2xhcmUgZnVuY3Rpb24gbG9jYWw6ZigkeCBhcyB4czpsb25nLCAkeSBhcyB4czpO
Q05hbWUpIGFzIGVsZW1lbnQoZSk/IHsgPGUgeD0ieyR4fSIgeT0ieyR5fSIvPiB9OyANCjwvcHJl
Pg0KDQo8cD5UaGUgZGVjbGFyZWQgdHlwZSBvZiB0aGUgZnVuY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