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 4242 - [FS] Static typing of name tests
Summary: [FS] Static typing of name tests
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Michael Dyck
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
: 4581 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-17 08:31 UTC by Jens Teubner
Modified: 2007-10-03 23:05 UTC (History)
1 user (show)

See Also:


Attachments

Description Jens Teubner 2007-01-17 08:31:40 UTC
Hi Jerome,

correct me if I am wrong, but I think there is a problem with the static type inference rules in Section 8.2.3.1.1 (Name Tests).

Consider the expression

  $v/self::foo

and $v has the static type `element *' (we know it's exactly one element, but we don't know its name).

The Formal Semantics essentially depends on two judgments to derive the result type of this expression:

  axis self:: of element * : element *      (Sect. 8.2.2.1.2)

then

  test foo with element of element * : element foo .

The latter is a rule in Section 8.2.3.1.1 where we perform a (non-wildcard) name test on an element type with a wildcard name:


--------------------------------------------------------------------------------
 test QName2 with element of element * OptTypeSpec : element QName2 OptTypeSpec

I think a `?' occurrence indicator is missing here.  If $v in the above example is a `foo' element, the result type is indeed `element foo'.  But if $v carries a different name (say, `bar') the path step will return the empty sequence (which would not be permitted by the above static typing rule).

The same problem arises also in some of the remaining judgments in Section 8.2.3.1.1.
Comment 1 Jim Melton 2007-02-26 00:10:01 UTC
The fix for this bug does not appear in the Recommendation of 23 January 2007. 
It will be considered for a future publication (either an Errata document or
some possible future version of the specification). 
Comment 2 Michael Dyck 2007-04-28 07:32:56 UTC
I agree with the original comment. Specifically, we need to append a '?' to the conclusion of rules 2, 5, 7, 10, 13, and 15 (i.e., the rules with "element * OptTypeSpecifier" or "attribute * OptTypeReference").

(You might think that rules 3 and 11 would also be affected, but they'll be deleted pursuant to Bug 3269.)
Comment 3 Michael Dyck 2007-05-03 02:14:58 UTC
The working groups have approved the solution given in Comment #2. Consequently, I am marking this bug FIXED. Please indicate your acceptance of this resolution by marking the bug CLOSED.
Comment 4 Jens Teubner 2007-05-03 12:21:01 UTC
The solution looks fine to me.  Thanks!
Comment 5 Nick Jones 2007-05-30 09:06:10 UTC
*** Bug 4581 has been marked as a duplicate of this bug. ***
Comment 6 Michael Dyck 2007-10-03 23:05:02 UTC
This issue has been incorporated into FS erratum E018, whose fix has been committed to the source files for the next edition of the FS document.