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 3669 - Type checking of () GeneralOp [value]
Summary: Type checking of () GeneralOp [value]
Status: CLOSED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-07 15:46 UTC by Tim Mills
Modified: 2006-10-19 19:48 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2006-09-07 15:46:07 UTC
The formal semantics expansion of:

() eq 1

is

some $v1 in fn:data(()) satisfies
some $v2 in fn:data(1) satisfies
let $u1 := fs:convert-operand($v1, $v2) return
let $u2 := fs:convert-operand($v2, $v1) return
fs:eq ($u1, $u2)

Because:

statEnv |-  data on empty : empty

fn:data(()) is of type empty.

Therefore $u1 must be of type empty.  This is bad news for convert-operand, since $expected is of type xs:anyAtomicType.
Comment 1 Jerome Simeon 2006-09-26 14:31:12 UTC
Tim,

Since the title of your comment is on General comparisons, I believe you meant to say '() = 1' ?

I am not sure I understand what the problem you are trying to point out is.

The normalization should be indeed what you suggest:

some $v1 in fn:data(()) satisfies
some $v2 in fn:data(1) satisfies
let $u1 := fs:convert-operand($v1, $v2) return
let $u2 := fs:convert-operand($v2, $v1) return
fs:eq ($u1, $u2)

The inference should go as follows:

() has type empty
fn:data(()) has type empty
the some expression is typed through a prime type. so $v1 will
be of type 'none' which should make sure the rest of the
type checking succeeds. This is because in fact 'some' does
not iterate at all over the empty sequence, the rest of the
expression will not even be evaluated.
the final type for the expression should be xs:boolean.

- Jerome
Comment 2 Tim Mills 2006-09-26 15:07:34 UTC
> Since the title of your comment is on General comparisons, I believe you meant
> to say '() = 1' ?

Yes, my mistake.

In another posting you made the point that, effectively, type empty is equivalent to none?, and also that none is a subtype of all other types.

At the time of posting, I'd missed out the rule that prime(empty) = none. I had prime(empty) = empty, which was the root cause of my typechecking problem.

Therefore this report can be ignored.  Thanks for your help.
Comment 3 Jerome Simeon 2006-09-26 15:58:01 UTC
Sorry reopened this bug by mistake ^_^.
Thanks for your quick response on this.
- Jerome