<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15807</bug_id>
          
          <creation_ts>2012-01-31 11:13:18 +0000</creation_ts>
          <short_desc>[XP30] 3.16.3 Cast - {variety}simple?</short_desc>
          <delta_ts>2012-02-15 09:15:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XPath 3.0</component>
          <version>Member-only Editors Drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://www.w3.org/XML/Group/qtspecs/specifications/xquery-30/html/xquery-30.html#id-cast</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Mills">tim</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>jim.melton</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>63395</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-01-31 11:13:18 +0000</bug_when>
    <thetext>The XQuery 3.0 specification states in 3.16.3 Cast

&quot;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.&quot;

However, XML Schema states:

&quot;{variety}

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

i.e. {variety} doesn&apos;t include &apos;simple&apos;.

This also appears in 3.16.4 Castable and the appendix entry for err:XQST0052</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63396</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2012-01-31 12:05:20 +0000</bug_when>
    <thetext>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 ( &quot;cast&quot; &quot;as&quot; SingleType )?
[164]    	SingleType 	   ::=    	SimpleTypeName &quot;?&quot;?
[169]    	AtomicOrUnionType 	   ::=    	EQName</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63761</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-02-06 16:47:29 +0000</bug_when>
    <thetext>It should say &apos;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*&apos;.

(Did we really end up deciding to call this class of union types &quot;restricted union types&quot;? I remember there was a lot of confusion about using this term for union types that do not incorporate a restriction.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63762</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2012-02-06 16:54:57 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64082</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-02-14 13:11:53 +0000</bug_when>
    <thetext>Changing to XPath 3.0, since it affects both specs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64134</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2012-02-15 09:15:16 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; The XQuery 3.0 specification states in 3.16.3 Cast
&gt; 
&gt; &quot;The SimpleTypeName must be the name of a type defined in the in-scope schema
&gt; types, and the {variety} of the type must be simple.&quot;
 
We will change &quot;and the {variety} of the type must be simple&quot; to &quot;and the type must be simple&quot;.

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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>