<?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>21960</bug_id>
          
          <creation_ts>2013-05-08 03:37:04 +0000</creation_ts>
          <short_desc>FOTS test case K2-ExternalVariablesWith-22 should raise XPTY0004</short_desc>
          <delta_ts>2013-06-14 14:38:57 +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>XQuery 3 &amp; XPath 3 Test Suite</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></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="Markos Zaharioudakis">markos_za</reporter>
          <assigned_to name="O&apos;Neil Delpratt">oneil</assigned_to>
          <cc>mike</cc>
    
    <cc>tim</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>87402</commentid>
    <comment_count>0</comment_count>
    <who name="Markos Zaharioudakis">markos_za</who>
    <bug_when>2013-05-08 03:37:04 +0000</bug_when>
    <thetext>I think that test case K2-ExternalVariablesWith-22 (in prod-VarDecl.external) should raise XPTY0004 instead of returning a result. This is because the type of the &lt;e/&gt; constructed node is xs:anyType, given that the default construction mode is preserve. So, &lt;e/&gt; is not an instance of element(*, xs:untyped?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87713</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-05-15 11:18:57 +0000</bug_when>
    <thetext>I think you are right. Odd that no-one has tripped over this before. It might be because most processors don&apos;t evaluate a global variable that is unreferenced, or perhaps because non-schema-aware processors treat all data as untyped.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88896</commentid>
    <comment_count>2</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2013-06-07 11:23:09 +0000</bug_when>
    <thetext>Assertion changed to error, with code XPTY0004.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89055</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-06-11 09:26:46 +0000</bug_when>
    <thetext>We do not report an error on this test case for the following reason.

&lt;e /&gt; is of type element(e, xs:anyType)

The declared type of $v is

element(*, xs:untyped?)+

Purely on use of the type information available, there exist values which match element(e, xs:anyType) and element(*, xs:untyped?)+.  Therefore this is postponed to a runtime (dynamic) check.

Since $v is never evaluated, this dynamic type check is never invoked, and therefore the dynamic error is never raised.  Thus the processor is entitled to return 1.

Generally, given a variable $v which is never evaluated, since a processor may implement dynamic type checking, any type check errors in the definition of $v may be legitimately ignored.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89077</commentid>
    <comment_count>4</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2013-06-11 12:08:20 +0000</bug_when>
    <thetext>*** Bug 11584 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89090</commentid>
    <comment_count>5</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2013-06-11 14:47:06 +0000</bug_when>
    <thetext>The bug #6988 might prove helpful in getting to a resolution on this bug issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89251</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-06-13 13:25:28 +0000</bug_when>
    <thetext>This test seems to have a long and unhappy history (see also bugs 11584 and 6988).

There seem to be two separate issues.

The first issue is that a processor that does dynamic type checking isn&apos;t obliged to raise any error because the global variable is never evaluated. To remove that problem, I propose to change the test to:

declare variable $v as element(*, xs:untyped?)+ := &lt;e/&gt;; exists($v/*)

The second issue is whether a processor is allowed to make the element untyped rather than anyType. This is the subject of bugs 11585 and 20828. I believe the outcome of these bugs is that if a processor does not support the typed data feature, then the constructed element will be untyped. I am therefore proposing to split the test into two, with dependencies to require the typed data feature to be on or off, and results false or error respectively.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89268</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-06-13 16:08:04 +0000</bug_when>
    <thetext>Test variant K2-ExternalVariablesWith-22a is marked as XQ10+, but prohibits the typed data feature in the catalog.

Since XQuery 1.0 never had a typed data feature, this seems a little strange.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89273</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-06-13 17:23:38 +0000</bug_when>
    <thetext>Well, we could make either or both tests be XQ30+ only. We would lose a test that existed for 1.0, but its interpretation in 1.0 was never clear-cut. I&apos;ll mark them both as XQ30+</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89313</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2013-06-14 14:38:57 +0000</bug_when>
    <thetext>Thanks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>