[Bug 4273] [FS] data on element()

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4273





------- Comment #9 from tim@cbcl.co.uk  2007-10-22 09:17 -------
declare variable $x as element(a, xs:anyType) external;
$x + 1

This fails static type checking because we cannot determine statically that
data($x) is convertible to a numeric value (ensuring that + is defined).  Note
that I believe data on xs:anyType to be xs:anyAtomicType* and not
xs:untypedAtomic as stated in the specification.

If we type check optimistically, it will pass and run to completion in the
event that the data($x) is convertible to a numeric value.  Otherwise a runtime
type check error will occur.  By type checking optimistically, the
implementation effectively introduces extra type constraints which it checks at
runtime.  It is as if the type of $x were treated as element(*, T) where T is
any type convertible (using fs:convert-operand) to a numeric type).


declare variable $x as element(a, xs:string) external;
$x + 1

As expected, this will fail type checking for all inputs.

Received on Monday, 22 October 2007 09:17:46 UTC