<?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>4277</bug_id>
          
          <creation_ts>2007-01-26 10:52:11 +0000</creation_ts>
          <short_desc>CastAs672</short_desc>
          <delta_ts>2009-06-01 22:37:11 +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>1.0.2</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</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="Michael Kay">mike</reporter>
          <assigned_to name="Carmelo Montanez">carmelo</assigned_to>
          
          
          <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>13807</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-01-26 10:52:11 +0000</bug_when>
    <thetext>The query CastAs672 reads:

let $var := (&quot;a&quot;,&quot;b&quot;,&quot;c&quot;) cast as xs:ENTITY 
return $var instance of xs:ENTITY

and the expected result is a dynamic error.

However, I believe that the rules on &quot;errors and optimization&quot; allow the value true to be returned. Static type inference can deduce that the result of the expression is either true or an error; the rules in 2.1 therefore allow the system to return true without checking for the error.

This conclusion is not obvious from a reading of section 2.1, but I believe it is correct. Section 2.1 doesn&apos;t allow the system to dispense with cardinality checks on a sequence that is wholly or partly evaluated; but it does allow such checks to be skipped in the case of a sequence that is not evaluated at all, because the value of the sequence is never used, and I believe that is the case here.

Suggestion: change the test to

(&quot;a&quot;,&quot;b&quot;,&quot;c&quot;) cast as xs:ENTITY 

which forces the error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14362</commentid>
    <comment_count>1</comment_count>
    <who name="Carmelo Montanez">carmelo</who>
    <bug_when>2007-03-09 14:29:50 +0000</bug_when>
    <thetext>Mike:

Thanks for teh comment.  Changed test as suggested.

Thanks,
Carmelo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25412</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-06-01 22:37:11 +0000</bug_when>
    <thetext>Despite comment #1, it appears this bug is still present in the test suite. I&apos;m fixing it by changing the query to

let $var := (&quot;a&quot;,&quot;b&quot;,&quot;c&quot;) cast as xs:ENTITY 
return count($var) lt 10</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>