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 21332 - [XP30] Literal out of range: static or dynamic error?
Summary: [XP30] Literal out of range: static or dynamic error?
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-19 10:51 UTC by Michael Kay
Modified: 2013-06-19 10:10 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2013-03-19 10:51:24 UTC
Test case fn-function-arity-017 does this

fn:function-arity( fn:concat#340282366920938463463374607431768211456 )

and permits the error FOAR0002.

The thinking here is presumably that the syntax describes the arity as an IntegerLiteral; the semantics of an IntegerLiteral are that it is converted to an integer using the string-to-integer conversion rules; and these rules say that if the integer is outside the implementation-defined range, a dynamic error FOAR0002 occurs.

There are several problems here.

(a) The range allowed for a function arity may be smaller than the range allowed for xs:integer. For example, it may be limited to 31 bits (!).

(b) FOAR0002 is a dynamic error. If this is going to be an error, it surely makes sense for it to be a static error. And the same goes of course for an IntegerLiteral (or any other literal) appearing directly in the query in any other context.

The distinction between static and dynamic errors needs to be made much more carefully in the context of try/catch. I'm encountering such problems as a result of converting QT3 tests to XSLT3 tests, where static and dynamic errors are handled differently by the test driver.
Comment 1 Tim Mills 2013-03-24 07:08:30 UTC
The declaration function lookup played some part in the development of this test.

fn:function-lookup($name as xs:QName, $arity as xs:integer) as function(*)?
Comment 2 Tim Mills 2013-03-24 08:28:32 UTC
The expected result was also based on the definition of MamedFunctionRef

[164]   	NamedFunctionRef	   ::=   	EQName "#" IntegerLiteral
[196]   	EQName	   ::=   	QName | URIQualifiedName

[126]   	NumericLiteral	   ::=   	IntegerLiteral | DecimalLiteral | DoubleLiteral
[197]   	IntegerLiteral	   ::=   	Digits

and the text describing construction of numeric literals.

"The value of a numeric literal containing no "." and no e or E character is an atomic value of type xs:integer. The value of a numeric literal containing "." but no e or E character is an atomic value of type xs:decimal. The value of a numeric literal containing an e or E character is an atomic value of type xs:double. The value of the numeric literal is determined by casting it to the appropriate type according to the rules for casting from xs:untypedAtomic to a numeric type as specified in Section 18.2 Casting from xs:string and xs:untypedAtomic FO30."
Comment 3 Michael Kay 2013-04-16 16:58:48 UTC
Decided to make no change to the spec: this is a dynamic error and can be caught. See new test case try-014.