- From: <bugzilla@wiggum.w3.org>
- Date: Wed, 07 Feb 2007 10:42:39 +0000
- To: public-qt-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4305
Summary: typeswitchhc12:
Product: XML Query Test Suite
Version: 1.0.2
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: XML Query Test Suite
AssignedTo: carmelo@nist.gov
ReportedBy: frans.englich@telia.com
QAContact: public-qt-comments@w3.org
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().
Received on Wednesday, 7 February 2007 10:42:58 UTC