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 3357 - K-SeqExprCastable-21
Summary: K-SeqExprCastable-21
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.9.4
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-18 21:01 UTC by Michael Kay
Modified: 2006-09-18 10:51 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-06-18 21:01:12 UTC
This test is:

not(() castable as xs:QName?)

I believe that the empty sequence is always castable to T?, therefore the result of this test should be not(true()) i.e. false. But the published results say true.
Comment 1 Frans Englich 2006-06-27 19:32:02 UTC
What you suggest is sensible, no doubt. However, what actually is specified is for me tricky to know -- these corner cases tend to be rather arbitrary.

Look at this quote:

XQuery/3.12.3 Cast
"If the target type of a cast expression is xs:QName, or is a type that is derived from xs:QName or xs:NOTATION, and if the base type of the input is not the same as the base type of the target type, then the input expression must be a string literal [err:XPTY0004]."

I think it rules out an empty sequence, or values of type xs:QName/xs:NOTATION for that matter too. I think this quote is inconsistent with
what F&O's 17.1.1 Casting from xs:string and xs:untypedAtomic says, which to me seems closer to what you describe here.

Since you've (re-)written these parts, I'll with interest see what you think is right here.

Does 3.12.3 Cast need an editorial fix(remove the paragraph and refer to F&O, or something like that)?

If the test should evaluate as you describe, this should evaluate to true:
() cast as xs:QName()?

I'm confident there's tests for that too, so those would need updating too.


Frans
Comment 2 Michael Kay 2006-07-09 08:22:01 UTC
In XQuery section 3.12.3, rule 3 says:

3. If the result of atomization is an empty sequence:

   a. If ? is specified after the target type, the result of the cast expression is an empty sequence.

The text you are quoting is from rule 4, which starts "If the result of atomization is a single atomic value", and which is therefore not applicable to this case.

Michael Kay
Comment 3 Frans Englich 2006-07-09 12:11:43 UTC
Yes, thanks for reading the spec for me.

Changes:

* K-SeqExprCastable-21 was changed to "() castable as xs:QName?", expecting "true", as suggested
* K-SeqExprCast-67, reading "() cast as xs:QName", was changed from expecting XPST0083 to XPTY0004
* K-SeqExprCast-71, being identical to K-SeqExprCast-67, was removed.
* Test was added which expects the empty sequence for "() cast as xs:QName?"

Is this satisfactory?

(Note that the test names refers to the latest revision in CVS and most likely correspond to different tests in 0.9.0, due to them being generated).


Frans
Comment 4 Frans Englich 2006-07-13 13:12:39 UTC
I'm resolving this bug. Feel free to change status to CLOSED when appropriate(or reopen).


Frans
Comment 5 Frans Englich 2006-09-18 10:51:11 UTC
Assuming the resolution is acceptable; changing status to CLOSED.