<?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>4305</bug_id>
          
          <creation_ts>2007-02-07 10:42:38 +0000</creation_ts>
          <short_desc>typeswitchhc12:</short_desc>
          <delta_ts>2007-03-09 21:46:20 +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>Other</rep_platform>
          <op_sys>Linux</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="Frans Englich">frans.englich</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>13916</commentid>
    <comment_count>0</comment_count>
    <who name="Frans Englich">frans.englich</who>
    <bug_when>2007-02-07 10:42:38 +0000</bug_when>
    <thetext>Test typeswitchhc12 reads:

-----------------------------------------
(: Name: typeswitchhq12 :)
(: Description: Simple test for evaluating dynamic error raised by default clause (no error raised) :)

typeswitch(123)
 case $i as xs:string
    return &lt;wrap&gt;test failed&lt;/wrap&gt; 
 case $i as xs:double
    return &lt;wrap&gt;test failed&lt;/wrap&gt; 
 case $i as xs:integer
    return &lt;wrap&gt;test passed - If a dynamic error is generated, then test failed.&lt;/wrap&gt;
 default
   return 12 div 0
-----------------------------------------

I think this test is wrong, which I base on that 2.3.1 Kinds of Errors reads:

&quot;Independently of whether the Static Typing Feature is in effect, if an implementation can determine during the static analysis phase that an expression, if evaluated, would necessarily raise a type error or a dynamic error, the implementation may (but is not required to) report that error during the static analysis phase. However, the fn:error() function must not be evaluated during the static analysis phase.&quot;

So, an implementation may raise a dynamic error during compile, unless it&apos;s fn:error(). I think the conditions are met: &quot;if evaluated, would necessarily raise a type error&quot;.

I suggest replacing &quot;12 div 0&quot; with a call to fn:error().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13917</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-02-07 11:33:16 +0000</bug_when>
    <thetext>I think we never really got the rules on when you can and can&apos;t raise errors consistent.

Section 2.3.4 contains the statement: &quot;Conditional and typeswitch expressions raise only dynamic errors that occur in the branch that is actually selected.&quot; which represents at least one of the views of the WG on the matter. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14381</commentid>
    <comment_count>2</comment_count>
    <who name="Carmelo Montanez">carmelo</who>
    <bug_when>2007-03-09 21:46:20 +0000</bug_when>
    <thetext>Hey Frans:

Given Mike&apos;s explanation below, I will mark this case as resolved for now.  Please reopen it if you disagree.

Thanks,
carmelo</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>