This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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().
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.
Hey Frans: Given Mike's explanation below, I will mark this case as resolved for now. Please reopen it if you disagree. Thanks, carmelo