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 29199 - [QT3TS] cbcl-cast-date-004, cbcl-cast-dateTime-004
Summary: [QT3TS] cbcl-cast-date-004, cbcl-cast-dateTime-004
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Tim Mills
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-13 14:55 UTC by Debbie Lockett
Modified: 2015-11-04 09:59 UTC (History)
5 users (show)

See Also:


Attachments

Description Debbie Lockett 2015-10-13 14:55:23 UTC
In test set prod-CastExpr.derived, the test cbcl-cast-date-004:

"18446744073709551616-QQ-15" cast as xs:date

expects error FORG0001. However it appears that FODT0001 should also be accepted. 

See section 19.2 of the FO31 spec, which specifies:
"In casting to xs:date, xs:dateTime, xs:gYear, or xs:gYearMonth (or types derived from these), if the value is too large or too small to be represented by the implementation, a dynamic error [err:FODT0001] is raised."
and 
"If the cast fails for any other reason, a dynamic error [err:FORG0001] is raised."

Similarly for test cbcl-cast-dateTime-004
Comment 1 Abel Braaksma 2015-11-03 15:57:01 UTC
> if the value is too large or too small to be represented by the implementation, 
> a dynamic error [err:FODT0001] is raised.

I have had a similar discussion a while back (can't remember the bug id), but I believe this was *only* for cases were facets are out of bounds, *after* parsing.

The question is, is this date format invalid ("QQ") or is it overflowing ("18446744073709551616"). I'd argue that any type first needs to be parsed before it gets converted into an internal data representation, in which case this would *not* be an overflow case, but an invalid date case.

Note, from a parsing perspective, the XSD facet for year allows "18446744073709551616". So, during parsing and facet validation, this part is valid, only after that the overflow *may* kick in, but we never get that far.
Comment 2 Michael Kay 2015-11-03 16:37:19 UTC
Abel: it's very common these days (and probably always has been) for the different phases of static analysis (tokenization, syntax analysis, semantic checking) to be done in parallel, rather than finishing one phase before the next one starts. You're suggesting that when processing dates, syntax analysis has to complete before semantic anaylsis starts. I don't find any statement in the spec that supports this position.
Comment 3 Abel Braaksma 2015-11-03 17:44:24 UTC
> You're suggesting that when processing dates, syntax analysis has to 
> complete before semantic anaylsis starts. I don't find any statement 
> in the spec that supports this position.

I wholeheartedly agree and glad you say so, it requires less special-casing in an implementation. I think this is a good thing. The way I read the errors and the spec and the way I made some changes in the past was precisely because I thought parsing comes first, then the rest (which is only relevant for a certain class of errors, most notably the overflow ones).

It'd be nice if there is no necessity to do so and to be lenient with errors like these.
Comment 4 Michael Kay 2015-11-03 19:07:23 UTC
Note also that the grammar allows the year part of the date to be indefinitely long, so in any system with a limit on the length of strings, there are going to to be some cases where the system hits a limit even though the date is syntactically valid.
Comment 5 O'Neil Delpratt 2015-11-04 09:14:27 UTC
I have resolved this bug by adding the extra error code in the test cases as suggested in comment #0