- From: <bugzilla@jessica.w3.org>
- Date: Fri, 12 Oct 2012 10:32:01 +0000
- To: public-qt-comments@w3.org
- Message-ID: <bug-19504-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=19504 Priority: P2 Bug ID: 19504 Assignee: oneil@saxonica.com Summary: [QT3TS] instanceof139 QA Contact: public-qt-comments@w3.org Severity: normal Classification: Unclassified OS: Windows NT Reporter: tim@cbcl.co.uk Hardware: PC Status: NEW Version: Working drafts Component: XQuery 3 & XPath 3 Test Suite Product: XPath / XQuery / XSLT The test instanceof139 expects false, but I think it should expect true. <test-case name="instanceof139" covers="sequence-type-relationships type-derivation-with-unions"> <description>Instance of with function types and union types. Note: there is no subtype relationship between union(A,B,C) and union(A,B).</description> <created by="Michael Kay" on="2012-10-08"/> <environment ref="union-List-defined-Types"/> <dependency type="spec" value="XQ30+"/> <dependency type="feature" value="higherOrderFunctions"/> <test><![CDATA[ import schema namespace s="http://www.w3.org/XQueryTest/unionListDefined"; declare function local:f($a as s:approximateDate) as xs:boolean { true() }; local:f#1 instance of function(s:dateOrDateTime) as xs:boolean ]]></test> <result> <assert-false/> </result> </test-case> In short, local:f#1 always returns boolean (thus the return typed match) and can accept a date or dateTime (the union of which is s:dateOrDateTime). here's the detail. local:f#1 is an instance of function(s:dateOrDateTime) as boolean if the judgement subtype-itemtype(Ai, Bi) determines that the ItemType Ai is a subtype of the ItemType Bi, where Ai = function(s:approximateDate) as boolean Bi = type function(s:dateOrDateTime) as boolean Ai is a subtype of Bi if and only if at least one of the following conditions applies: 24. Bi is AnnotationsB function(Ba_1, Ba_2, ... Ba_N) as Br, Ai is AnnotationsA function(Aa_1, Aa_2, ... Aa_M) as Ar, where [AnnotationsB] and [AnnotationsA] are optional lists of one or more annotations; N (arity of Bi) equals M (arity of Ai); subtype(Ar, Br); for values of I between 1 and N, subtype(Ba_I, Aa_I) ; and subtype-assertions(AnnotationsA, AnnotationsB) . Here Aa_1 = s:approximdateDate Ar = boolean Ba_1 = s:dateOrDateTime Br = boolean Clearly subtype(Ar, Br); = subtype(boolean, boolean) holds. That leaves, subtype(s:dateOrDateTime, s:approximateDate). This holds if: 1. s:dateOrDate and s:approximateDate are AtomicOrUnionTypes, and derives-from(s:dateOrDate, s:approximateDate) returns true. Now, s:dateOrDateTime = xs:date | xs:dateTime s:approximateDate = xs:date | xs:dateTime | xs:gYear | xs:gYearMonth So derives-from(s:dateOrDateTime, s:approximateDate) must hold and thus the expected result must be true. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Friday, 12 October 2012 10:32:06 UTC