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 15807 - [XP30] 3.16.3 Cast - {variety}simple?
Summary: [XP30] 3.16.3 Cast - {variety}simple?
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: https://www.w3.org/XML/Group/qtspecs/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-31 11:13 UTC by Tim Mills
Modified: 2012-02-15 09:15 UTC (History)
2 users (show)

See Also:


Attachments

Description Tim Mills 2012-01-31 11:13:18 UTC
The XQuery 3.0 specification states in 3.16.3 Cast

"The SimpleTypeName must be the name of a type defined in the in-scope schema types, and the {variety} of the type must be simple."

However, XML Schema states:

"{variety}

 One of {atomic, list, union}. Required for all Simple Type Definitions except  ·anySimpleType·, in which it is absent."

i.e. {variety} doesn't include 'simple'.

This also appears in 3.16.4 Castable and the appendix entry for err:XQST0052
Comment 1 Tim Mills 2012-01-31 12:05:20 UTC
Also in this section, the EBNF rule [169] is reproduced, although it is not referenced in [94] or [164].  Does this indicate an error?

[94]    	CastExpr 	   ::=    	UnaryExpr ( "cast" "as" SingleType )?
[164]    	SingleType 	   ::=    	SimpleTypeName "?"?
[169]    	AtomicOrUnionType 	   ::=    	EQName
Comment 2 Michael Kay 2012-02-06 16:47:29 UTC
It should say 'The SimpleTypeName must be the name of a *generalized atomic type* defined in the in-scope schema types, that is, either an atomic type or a *restricted union type*'.

(Did we really end up deciding to call this class of union types "restricted union types"? I remember there was a lot of confusion about using this term for union types that do not incorporate a restriction.)
Comment 3 Michael Kay 2012-02-06 16:54:57 UTC
Actually, 5(d) makes it clear that we allow casting from string/untypedAtomic to any simple type whatsoever. So (a) my comment 2 is wrong, and (b) the presence of the production AtomicOrUnionType in this section is an anachronism.

We also allow casting from an instance of one of the member types of a union to the union type, and from a value that is castable to one of the member types of a union to the union type. These cases should probably be included in the list of cases in rule 5.
Comment 4 Jonathan Robie 2012-02-14 13:11:53 UTC
Changing to XPath 3.0, since it affects both specs.
Comment 5 Jonathan Robie 2012-02-15 09:15:16 UTC
(In reply to comment #0)
> The XQuery 3.0 specification states in 3.16.3 Cast
> 
> "The SimpleTypeName must be the name of a type defined in the in-scope schema
> types, and the {variety} of the type must be simple."
 
We will change "and the {variety} of the type must be simple" to "and the type must be simple".

Also, we need to add these two cases to the list of allowable casts:

* We allow casting from one of the members of a union to a union type.
* We allow casting from a value to a union type if you can cast to any member of the union.

We will also remove production 169 from that section.