- From: <bugzilla@jessica.w3.org>
- Date: Thu, 12 Feb 2015 13:30:34 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26865
Tim Mills <tim@cbcl.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #10 from Tim Mills <tim@cbcl.co.uk> ---
I hate to reopen this but...
CastableAs653
import schema namespace d="http://www.w3.org/XQueryTest/derivedTypes";
12 castable as d:canonicalDecimal
Following through the rules:
TT = d:canonicalDecimal
ST = xs:integer
SV = xs:integer(12)
Casting a value to a derived type can be separated into four cases. Note that
xs:untypedAtomic, xs:integer and the two derived types of
xs:duration:xs:yearMonthDuration and xs:dayTimeDuration are treated as
primitive types.
* When SV is an instance of a type that is derived by restriction from TT.
This is described in section 19.3.2 Casting from derived types to parent types.
SV xs:integer(12) is not derived by restriction from TT (d:canonicalDecimal)
* When SV is an instance of a type derived by restriction from the same
primitive type as TT. This is described in 19.3.3 Casting within a branch of
the type hierarchy.
SV xs:integer(12) has type xs:integer.
xs:integer is derived from xs:decimal, the primitive type of TT
(d:canonicalDecimal). Hence this is a cast within the branch the type
hierarchy.
I suspect that the rules can be simplified to:
1. When SV is an immediate instance of TT, the cast always succeeds,
returning SV unchanged.
2. When SV is an instance of a type that is derived by restriction from TT,
the cast proceeds as described in section 19.3.2 Casting from derived types to
parent types.
3. When the primitive type of SV is the same as the primitive type of TT,
the cast proceeds as described in 19.3.3 Casting within a branch of the type
hierarchy.
4. Otherwise, the derived type is derived, directly or indirectly, from a
different primitive type than the primitive type of ST. Casting proceeds as
described in 19.3.4 Casting across the type hierarchy.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Thursday, 12 February 2015 13:30:37 UTC