<?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>29220</bug_id>
          
          <creation_ts>2015-10-21 15:33:27 +0000</creation_ts>
          <short_desc>[QT30] map-merge-003-hof, map-entry-001-hof, map-put-003-hof</short_desc>
          <delta_ts>2015-11-06 16:48:25 +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>WONTFIX</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="Christian Gruen">christian.gruen</reporter>
          <assigned_to name="O&apos;Neil Delpratt">oneil</assigned_to>
          <cc>abel.braaksma</cc>
    
    <cc>mike</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>123827</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-10-21 15:33:27 +0000</bug_when>
    <thetext>The test case &quot;map-merge-003-hof&quot; contains the following query:

  map:merge(map:entry(&quot;foo&quot;, 1 to 5))

One of the tests is:

  &lt;not&gt;&lt;assert-type&gt;function(xs:anyURI) as xs:integer*&lt;/assert-type&gt;&lt;/not&gt;

I believe this should be inverted to...

  &lt;assert-type&gt;function(xs:anyURI) as xs:integer*&lt;/assert-type&gt;

...because I think it is allowed to specify URIs as function argument:

  map:merge(map:entry(&quot;foo&quot;, 1 to 5))(xs:anyURI(&apos;x&apos;))

However, the instance test should yield false, if the return type differs from the type of the map values, so this would be another alternative:

  &lt;not&gt;&lt;assert-type&gt;function(xs:string) as xs:anyURI*&lt;/assert-type&gt;&lt;/not&gt;

The same observation applies to map-entry-001-hof and map-put-003-hof.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124057</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-11-03 15:43:33 +0000</bug_when>
    <thetext>XPath 2.5.5.8 says:

The function signature of the map, treated as a function, is always function(xs:anyAtomicType) as item()*, regardless of the actual types of the keys and values in the map. §§This means that a function item type with a more specific return type, such as function(xs:anyAtomicType) as xs:integer, does not match a map in the sense required to satisfy the instance of operator.§§ However, the rules for function coercion mean that any map can be supplied as a value in a context where such a type is the required type, and a type error will only occur if an actual call on the map (treated as a function) returns a value that is not an instance of the required return type.

I think that if you are challenging this test case then you are challenging this statement in the spec, especially the sentence I have marked with §§..§§.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124065</commentid>
    <comment_count>2</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-11-03 19:04:36 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #1)
&gt; §§This means that a function item type with a more specific return type,
&gt; such as function(xs:anyAtomicType) as xs:integer, does not match a map
&gt; in the sense required to satisfy the instance of operator.§§
&gt; [...]
&gt; I think that if you are challenging this test case then you are challenging
&gt; this statement in the spec, especially the sentence I have marked with
&gt; §§..§§.
Yes, it may well be that the spec needs to be revised as well. – In the discussed test, it is assumed that 

  map { &quot;foo&quot;, 1 to 5 } instance of function(xs:anyURI) as xs:integer*

yields false, but I believe it should yield true.

However, the result should not be true for the example return type in the spec (xs:integer), because the returned result of a map can always be the empty sequence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124067</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-11-03 19:12:26 +0000</bug_when>
    <thetext>The rule in the spec has been very extensively discussed by the WG and I believe it correctly reflects what the WG decided. I&apos;m afraid I don&apos;t recall all the detailed reasoning.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124068</commentid>
    <comment_count>4</comment_count>
    <who name="Christian Gruen">christian.gruen</who>
    <bug_when>2015-11-03 19:25:47 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #3)
&gt; The rule in the spec has been very extensively discussed by the WG and I
&gt; believe it correctly reflects what the WG decided. I&apos;m afraid I don&apos;t recall
&gt; all the detailed reasoning.

I see, and I agree: If the actual map contents are to be ignored, the solution is indeed consistent with the spec. Thanks for the clarification!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>