#849 Incorrect type-checking in push mode

v9.1
closed
7
2012-10-08
2008-07-22
Michael Kay
No

When a sequence of items is type-checked at run time in push mode, items after the first are checked not only against the type checking rules that apply to that item, but also against the rules that apply to previous items in the sequence, causing a spurious type error.

An example where this can occur is with a function such as

declare function f($a as element(a), $b as element(b)) {
<out>{
$a, $b
}</out>
}

This is evaluated in push mode because the body of the function is an element constructor (push mode means that the code is evaluated top-down rather than bottom up: it starts by writing a start tag to the current output destination, then evaluates $a and $b and writes their results to the output destination, then writes the end tag). In this example there is only one reference to $a, and to $b, so the type-checking code for the function parameters is moved inline to where the variables are referenced, and the bug causes the value of $b to be checked against both element(b) and then element(a).

The bug is present in both 9.0 and 9.1 and a patch will be placed in Subversion for both releases.

Discussion

  • Michael Kay

    Michael Kay - 2008-07-22

    Logged In: YES
    user_id=251681
    Originator: YES

    The incorrect code is also present on the 8.8 and 8.9 branches, and I have fixed both in Subversion in case either release is ever rebuilt.

     
  • Michael Kay

    Michael Kay - 2008-09-02

    Logged In: YES
    user_id=251681
    Originator: YES

    Fixed in 9.0.0.8 and 9.1.0.2

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks