This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4305 - typeswitchhc12:
Summary: typeswitchhc12:
Status: RESOLVED WONTFIX
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 1.0.2
Hardware: Other Linux
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-07 10:42 UTC by Frans Englich
Modified: 2007-03-09 21:46 UTC (History)
0 users

See Also:


Attachments

Description Frans Englich 2007-02-07 10:42:38 UTC
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 <wrap>test failed</wrap> 
 case $i as xs:double
    return <wrap>test failed</wrap> 
 case $i as xs:integer
    return <wrap>test passed - If a dynamic error is generated, then test failed.</wrap>
 default
   return 12 div 0
-----------------------------------------

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

"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."

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

I suggest replacing "12 div 0" with a call to fn:error().
Comment 1 Michael Kay 2007-02-07 11:33:16 UTC
I think we never really got the rules on when you can and can't raise errors consistent.

Section 2.3.4 contains the statement: "Conditional and typeswitch expressions raise only dynamic errors that occur in the branch that is actually selected." which represents at least one of the views of the WG on the matter. 
Comment 2 Carmelo Montanez 2007-03-09 21:46:20 UTC
Hey Frans:

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

Thanks,
carmelo