This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
We say for xsl:override of functions, "The types of the arguments are pairwise identical.... The return types are identical." It would be more precise to say what we mean by "the type of", e.g. to talk of "the declared type, defaulting to item()*"
Abel asks: does XPath have a definition of type equality, e.g. is union(A,B) identical to union(B,A)?
The answer to the question in comment #2 is that we do have a definition of "identical types" in 3.5.3.3: [Definition: Types S and T are considered identical for the purpose of these rules if and only if subtype(S, T) and subtype(T, S) both hold, where the subtype relation is defined in Section 2.5.6.1 The judgement subtype(A, B) XP30.] This rule means, for example, that union(double, decimal) is the same type as union(decimal, double).
The language has been tightened up a little: <p>The <phrase diff="chg" at="T-bug29686">declared types of the arguments (defaulting to <code>item()*</code>)</phrase> are pairwise <termref def="dt-identical-types">identical</termref>.</p> <p>The <phrase diff="chg" at="T-bug29686">declared return types (defaulting to <code>item()*</code>)</phrase> are <termref def="dt-identical-types">identical</termref>.
Reopened because there was discussion about whether this definition of "identical" actually works - e.g. if untypedAtomic is supplied to union(double, decimal) the effect is different from when it's union(decimal, double).
I have added a test case override-f-031
The WG discussed this on 23 June 2016. I was given an action to add a note going into more detail about the consequences of the rule on "identical" types, which I have done as follows: <p> Consider a function that accepts an argument whose declared type is a union type with member types <code>xs:double</code> and <code>xs:decimal</code>, in that order (we might write this as <code>union(xs:double, xs:decimal)</code>). Using the same notation, this can be overridden by a function that declares the argument type as <code>union(xs:decimal, xs:double)</code>. This does not affect type checking: a a function call that passes the type checking rules with one signature will also pass the type checking rules with the other. It does however affect the way that the function conversion rules work: a call that passes the <code>xs:untypedAtomic</code> value <code>"93.7"</code> (or an untyped node with this as its string value) will be converted to an <code>xs:decimal</code> in one case and an <code>xs:double</code> in the other. </p>