[Bug 4521] K2-Axes-32

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4521

           Summary: K2-Axes-32
           Product: XML Query Test Suite
           Version: 1.0.2
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XML Query Test Suite
        AssignedTo: andrew.eisenberg@us.ibm.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


Having started to look at optimization of queries, I believe this query can be
reduced to "true" avoiding the expected error.

Since (/) introduces a "treat as document", the static type of the argument to
fn:root can be deduced as empty-sequence, because we know that the parent of a
document node is empty-sequence.  fn:root therefore returns empty-sequence,
then empty() returns true.

I believe this to be similar to the case pointed out by Mike Kay in bug report
4277 (in which static type analysis means that a cast which would fail need not
be evaluated).

(:*******************************************************:)
(: Test: K2-Axes-32                                      :)
(: Written by: Frans Englich                             :)
(: Date: 2007-01-22T21:16:10+01:00                       :)
(: Purpose: Apply axis '..' to the return value of fn:root(). :)
(:*******************************************************:)
declare variable $myVar := <e/>;
            empty(fn:root($myVar/(/)/..))

Received on Wednesday, 2 May 2007 13:25:48 UTC