Nicolae Brinza has proposed merging lp:~nbrinza/zorba/bugs2 into lp:zorba. Commit message: date/time/durations castings now throw FODT0001 instead of FORG0001, as required by the 3.0 spec.
Requested reviews: Zorba Coders (zorba-coders) Related bugs: Bug #898792 in Zorba: "xs:QName fails for non-literal input" https://bugs.launchpad.net/zorba/+bug/898792 Bug #931501 in Zorba: "improve error message for fn:format-number" https://bugs.launchpad.net/zorba/+bug/931501 Bug #1154367 in Zorba: "yearMonthDuration arithmetic bug" https://bugs.launchpad.net/zorba/+bug/1154367 For more details, see: https://code.launchpad.net/~nbrinza/zorba/bugs2/+merge/156766 date/time/durations castings now throw FODT0001 instead of FORG0001, as required by the 3.0 spec. -- https://code.launchpad.net/~nbrinza/zorba/bugs2/+merge/156766 Your team Zorba Coders is requested to review the proposed merge of lp:~nbrinza/zorba/bugs2 into lp:zorba.
=== modified file 'src/diagnostics/diagnostic_en.xml' --- src/diagnostics/diagnostic_en.xml 2013-04-03 07:30:48 +0000 +++ src/diagnostics/diagnostic_en.xml 2013-04-03 08:29:30 +0000 @@ -1355,7 +1355,7 @@ <comment> Overflow/underflow in date/time operation. </comment> - <value>overflow/underflow in date/time operation</value> + <value>overflow/underflow in date/time operation${: 1}</value> </diagnostic> <diagnostic code="FODT0002"> === modified file 'src/diagnostics/pregenerated/dict_en.cpp' --- src/diagnostics/pregenerated/dict_en.cpp 2013-04-03 07:30:48 +0000 +++ src/diagnostics/pregenerated/dict_en.cpp 2013-04-03 08:29:30 +0000 @@ -49,7 +49,7 @@ { "FODC0007", "\"$1\": base URI passed to fn:parse() is not a valid absolute URI" }, { "FODF1280", "\"$1\": invalid decimal format name for fn:format-number()" }, { "FODF1310", "\"$1\": invalid picture string for decimal/integer${: 2}" }, - { "FODT0001", "overflow/underflow in date/time operation" }, + { "FODT0001", "overflow/underflow in date/time operation${: 1}" }, { "FODT0002", "overflow/underflow in duration operation${: 1}" }, { "FODT0003", "\"$1\": invalid timezone value (in seconds)" }, { "FOER0000", "unidentifier error" }, === modified file 'src/types/casting.cpp' --- src/types/casting.cpp 2013-03-26 20:23:10 +0000 +++ src/types/casting.cpp 2013-04-03 08:29:30 +0000 @@ -182,6 +182,36 @@ } } +void throwFODT0001Exception(const zstring& str, const ErrorInfo& info) +{ + if (info.theTargetType) + { + RAISE_ERROR(err::FODT0001, info.theLoc, + ERROR_PARAMS(ZED(FORG0001_NoCastTo_234), + str, + info.theSourceType->toSchemaString(), + info.theTargetType->toSchemaString())); + } + else + { + TypeManager& tm = GENV_TYPESYSTEM; + + xqtref_t sourceType = + tm.create_builtin_atomic_type(info.theSourceTypeCode, + TypeConstants::QUANT_ONE); + + xqtref_t targetType = + tm.create_builtin_atomic_type(info.theTargetTypeCode, + TypeConstants::QUANT_ONE); + + RAISE_ERROR(err::FODT0001, info.theLoc, + ERROR_PARAMS(ZED(FORG0001_NoCastTo_234), + str, + sourceType->toSchemaString(), + targetType->toSchemaString())); + } +} + /******************************************************************************* Identity casting functions: target type is the same as the source one, so no @@ -343,7 +373,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -358,7 +388,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -373,7 +403,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -386,7 +416,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -400,7 +430,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -413,7 +443,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -426,7 +456,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -439,7 +469,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -452,7 +482,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -465,7 +495,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -478,7 +508,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); } @@ -491,7 +521,7 @@ return; } - throwFORG0001Exception(strval, errInfo); + throwFODT0001Exception(strval, errInfo); }
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp