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 4248 - Static typing of K2-DocumentURIFunc-10
Summary: Static typing of K2-DocumentURIFunc-10
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-17 12:23 UTC by Tim Mills
Modified: 2007-01-23 17:34 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2007-01-17 12:23:13 UTC
The argument to fn:root is being typed as a zero-or-more sequence, hence there is a static type check error.

(:*******************************************************:)
(: Test: K2-DocumentURIFunc-10                           :)
(: Written by: Frans Englich                             :)
(: Date: 2007-01-15T15:15:45+01:00                       :)
(: Purpose: Invoke on a tree document node with fn:root(). :)
(:*******************************************************:)
let $i := document
{
<e>
        <a/>
        <a/>
        <a/>
            <b/>
            <b/>
        <a/>
        <a/>
</e>
}
return empty(document-uri(root($i/a/b[1])))
Comment 1 Tim Mills 2007-01-17 12:53:43 UTC
K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 also have the problem.
Comment 2 Frans Englich 2007-01-20 12:24:55 UTC
Doesn't the [1]-predicate ensure a more precise cardinality is inferred? Formal Semantics, 4.3.2 Filter Expressions reads:

"When a predicate with a numeric literal or the last() expression is applied on a primary expression, it is normalized using the fn:subsequence function. This results in a more precise static type for those cases."

7.2.13 The fn:subsequence function, reads:
"The fn:subsequence function has special static typing rules when its second argument is the numeric literal value 1 or the built-in variable $fs:last. These rules provide better typing for path expressions such as Expr[1] and Expr[fn:last()]."

Therefore, I currently guess that the mentioned tests doesn't have cardinality-related errors.

However, I think K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 should fail type check nevertheless because the declared type of the variable, doesn't match its operand:

declare variable $vA as xs:string := ("B STRING", current-time(), string(<e>content</e>))[1];
Comment 3 Tim Mills 2007-01-22 09:10:16 UTC
$i/a/b[1] is treated as:

$i / a / ( b [1] )

which types as a zero-or-more sequence.

and not:

( $i / a / b )[1]

would would type as a zero-or-one sequence.
Comment 4 Frans Englich 2007-01-22 19:49:20 UTC
Yes, I'll fix K2-DocumentURIFunc-10. Seems that K2-StartsWithFunc-1 to 6 and K2-EndsWithFunc-1 to 6 didn't have the cardinality error, but the item type mismatch previously fixed.
Comment 5 Frans Englich 2007-01-23 16:21:09 UTC
I believe all these issues should be fixed in recent CVS now.
Comment 6 Tim Mills 2007-01-23 17:34:21 UTC
K2-DocumentURIFunc-10 is now fixed.  Thanks.