#849 Incorrect type-checking in push mode

Michael Kay

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)) {
$a, $b

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.


  • Michael Kay

    Michael Kay - 2008-07-22

    Logged In: YES
    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
    Originator: YES

    Fixed in and


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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks