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 5791 - Static Typing: CVS: K-SeqExprInstanceOf-56, 57, 58
Summary: Static Typing: CVS: K-SeqExprInstanceOf-56, 57, 58
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-24 11:50 UTC by Tim Mills
Modified: 2008-06-26 12:05 UTC (History)
2 users (show)

See Also:


Attachments

Description Tim Mills 2008-06-24 11:50:16 UTC
In addition to expecting an error, this query may also return true because it
can be answered purely through static type analysis.  Similarly for K-SeqExprInstanceOf-57.  K-SeqExprInstanceOf-58 should expect false.

(:*******************************************************:)
(: Test: K-SeqExprInstanceOf-56                          :)
(: Written by: Frans Englich                             :)
(: Date: 2007-11-22T11:31:21+01:00                       :)
(: Purpose: The fn:error() function in combination with 'instance of'. :)
(:*******************************************************:)
error() instance of xs:integer
Comment 1 Frans Englich 2008-06-24 12:54:59 UTC
A fix was attempted in CVS.
Comment 2 Tim Mills 2008-06-24 13:46:27 UTC
I think you may have got the expected results wrong for the first two here.

It should be:

K-SeqExprInstanceOf-56 -> true
K-SeqExprInstanceOf-57 -> true

Comment 3 Tim Mills 2008-06-24 14:34:48 UTC
...and (my mistake):

K-SeqExprInstanceOf-58 -> false
Comment 4 Frans Englich 2008-06-24 15:20:40 UTC
I'm not sure I'm following, so K-SeqExprInstanceOf-56:

error() instance of xs:integer


should return true? none is an instance of xs:integer?
Comment 5 Tim Mills 2008-06-24 16:30:51 UTC
Though strange, I think that none _is_ an instance of xs:integer.  Can someone please confirm this?

'none' is definitely a subtype of xs:integer.  'none' is a subtype of all other types.

So this query can be boiled down to the question "is something shich is a subtype of xs:integer always an instance of xs:itneger".
Comment 6 Michael Dyck 2008-06-24 20:58:26 UTC
Is none a subtype of xs:integer? Yes.

Is none an instance of xs:integer? It's a bad question, because none denotes a type, not a value.

Instead, the proper question is something like: given an expression
    Expr instance of SequenceType
if the static type of Expr is a subtype of (the type denoted by) SequenceType, is an implementation allowed to rewrite the expression as fn:true()?

I believe you could prove that, in such a case, the only non-error outcome is the value true, and so (according to the XQuery rewriting rules) the rewrite is allowed.

The particular test case is an example of the general case, so I believe returning true is conformant. (However, I'm not familiar with the extent to which the test suite caters to rewrites.)
Comment 7 Frans Englich 2008-06-25 11:22:39 UTC
Ok, I changed the baselines as per instructed in comments #2 and #3.

A lot can be said about XQuery Formal Semantics.
Comment 8 Tim Mills 2008-06-25 12:37:02 UTC
> A lot can be said about XQuery Formal Semantics.

Only nice things I hope :)

I'll close this once I've checked the results.  CurrentlyI can't connect to CVS - it just hangs.
Comment 9 Tim Mills 2008-06-26 11:09:09 UTC
K-SeqExprInstanceOf-56 and K-SeqExprInstanceOf-57 are now correct.

I've given you the wrong expected result for:

K-SeqExprInstanceOf-58

error() instance of empty-sequence()

should be true.

The reason is that 'empty' is the same as 'none?'.  So this is like

(something of type T) instance of T?

which is true.


Comment 10 Frans Englich 2008-06-26 11:14:28 UTC
Should be fixed in CVS.
Comment 11 Tim Mills 2008-06-26 12:05:50 UTC
Thanks.