[Bug 7749] [XPath 2.0] derives-from() and union types

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7749





--- Comment #2 from Michael Kay <mike@saxonica.com>  2010-01-13 14:00:44 ---
Specific textual changes to implement the solution proposed in 

http://lists.w3.org/Archives/Member/w3c-xsl-query/2009Oct/0133.html
(member-only) are as follows, based on the Dec 2009 XQuery 1.1 Working Draft:

In 2.5.4, SequenceType matching, replace the entirety of the second bullet of
the definition of derives-from (which starts "derives-from( AT, ET ) returns
true [if] AT and ET are both present in S, and if one or more of the following
three conditions is true:...", other than the Note, by:

<new>
derives-from( AT, ET ) returns true if AT and ET are both present in S and AT
is validly derived from ET given the empty set, as defined in [XML Schema Pt 1]
constraints Type Derivation OK (Complex) (§3.4.6) (if AT is a complex type), or
Type Derivation OK (Simple) (§3.14.6) (if AT is a simple type).

Note: effectively this means that AT must either be derived from ET by
restriction or extension, or ET must be a union type of which AT is a member
type. The phrase "given the empty set" is used because the rules in the XML
Schema specification are parameterized: the parameter is a list of the kinds of
derivation that are not allowed, and in this case the list is always empty.

Note: The current (second) edition of XML Schema 1.0 contains an error in
respect of the substitutability of a union type by one of its members: it fails
to recognize that this is unsafe if the union is derived by restriction from
another union. This problem is fixed in the current working draft of XML Schema
1.1, and implementers are advised to adopt the solution given there. It is
likely that this specification will be updated to refer normatively to XML
Schema 1.1 when that specification reaches Recommendation status. 
</new>

I leave the question open as to whether the bug should be fixed in XQuery 1.0.
It's a serious bug that affects type soundness, especially for static typing
implementations, so in principle I think it should.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 13 January 2010 14:00:46 UTC