<?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>29937</bug_id>
          
          <creation_ts>2016-10-13 15:23:27 +0000</creation_ts>
          <short_desc>[QT3TS] fn-load-xquery-module-060</short_desc>
          <delta_ts>2016-10-19 12:51:56 +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>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="O&apos;Neil Delpratt">oneil</assigned_to>
          <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>127766</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-10-13 15:23:27 +0000</bug_when>
    <thetext>I disagree with the expected result of the test, and don&apos;t think the description matches the test.

The loaded module has no context item declaration, therefore doesn&apos;t place any restrictions on the context item type.

When the module is compiled, the compiler introduces dynamic type checking for the assignment

declare variable $cim:context as node() := .;

which will trigger an XPTY0004 if $cim:context happens to be evaluated.
 
  &lt;test-case name=&quot;fn-load-xquery-module-060&quot;&gt;
    &lt;description&gt;Checks for an error when calling fn:load-xquery-module and providing the wrong type of value for the context item.&lt;/description&gt;
    &lt;created by=&quot;Debbie Lockett&quot; on=&quot;2015-06-01&quot;/&gt;
    &lt;module uri=&quot;http://www.w3.org/fots/fn/load-xquery-module/context-item/module&quot; file=&quot;load-xquery-module/context-item2-module.xqm&quot;/&gt;
    &lt;test&gt;fn:load-xquery-module(&quot;http://www.w3.org/fots/fn/load-xquery-module/context-item/module&quot;, 
      map{&quot;context-item&quot; : &quot;item&quot;})&lt;/test&gt;
    &lt;result&gt;
      &lt;error code=&quot;FOQM0005&quot;/&gt;
    &lt;/result&gt;
  &lt;/test-case&gt;

xquery version &quot;3.1&quot;;

module namespace cim = &quot;http://www.w3.org/fots/fn/load-xquery-module/context-item/module&quot;;

declare variable $cim:context as node() := .;

declare function cim:get-context-child() as node()* {
    $cim:context/child::node()
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127768</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-10-13 15:39:58 +0000</bug_when>
    <thetext>I agree.

(We&apos;re passing this one because we redirect XPTY0004 to FOQM0005 rather indiscriminately, which is going to catch quite a few cases that shouldn&apos;t be caught).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127850</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-10-19 12:51:29 +0000</bug_when>
    <thetext>Now fixed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>