Align error codes with W3C XQuery spec#6263
Merged
Merged
Conversation
Contributor
|
looks like a test needs to be adjusted |
Member
Author
|
[This response was co-authored with Claude Code. -Joe] @duncdrum Thanks — you're right, the test assertion needs updating. The error code change from XQST0033 to XQST0066 is intentional (W3C alignment: XQST0066 is the correct code for rebinding the default namespace to a non-matching URI). Will update |
duncdrum
approved these changes
Apr 27, 2026
Member
|
@joewiz needs to be rebased |
Fix several error code mismatches caught by XQTS misc-CombinedErrorCodes: - XQDY0025: EnclosedExpr now detects INUSE_ATTRIBUTE_ERR DOMExceptions and raises XQDY0025 instead of generic exerr:ERROR (~4 tests) - XQDY0074: Computed element/attribute constructors raise XQDY0074 for invalid QNames instead of XPTY0004 (~4 tests) - FOCH0002: fn:sort, fn:index-of, fn:contains-token now pass FOCH0002 as the collation error code instead of defaulting to XQST0076 (~4 tests) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Continue error code alignment work for XQTS misc-CombinedErrorCodes: - XQST0090: Character reference NumberFormatException now uses proper error code instead of generic exerr:ERROR (StringValue.java) - XQST0067: Construction declaration duplicate check was using XQST0069 (empty order) instead of XQST0067 (construction) (XQueryTree.g) - XQST0069: Empty order declaration duplicate check was using XQST0065 (ordering mode) instead of XQST0069 (empty order) (XQueryTree.g) - XQST0066: Default element namespace rebinding now raises XQST0066 instead of XQST0033 when prefix is empty (XQueryContext.java) - XPTY0004: Variable type mismatch now includes proper error code instead of generic exerr:ERROR (VariableImpl.java) - XPTY0019: toNodeSet() methods on sequence types now use XPTY0019 instead of generic exerr:ERROR (ValueSequence, OrderedValueSequence, ArrayListValueSequence, RangeSequence) - XQST0046: Invalid URI cast now uses XQST0046 instead of generic exerr:ERROR (AnyURIValue.java) - XQST0009: Schema imports now properly rejected with XQST0009 instead of being silently ignored (XQueryTree.g) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… spec testReDeclareNamespaceEmptyPrefixFail now expects err:XQST0066, matching the W3C XQuery spec for default element namespace redeclaration. The empty prefix branch in XQueryContext was aligned with the spec earlier in this PR; updating the assertion to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3aa4662 to
623388a
Compare
Member
Author
|
[This response was co-authored with Claude Code. -Joe] @line-o Rebased onto current develop (force-pushed). The conflict in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several error code mismatches detected by XQTS
misc-CombinedErrorCodestest set. Each fix changes only the error code constant used — no behavioral changes to error detection logic.What Changed
XQDY0025 — Duplicate attribute detection in EnclosedExpr (~4 tests)
EnclosedExpr.java: When aDOMExceptionwithINUSE_ATTRIBUTE_ERRis caught during node copying in enclosed expressions, raiseXQDY0025instead of the genericexerr:ERROR. The duplicate attribute was already detected correctly — only the reported error code was wrong.XQDY0074 — Invalid computed element/attribute names (~4 tests)
ElementConstructor.java: Computed element constructors now raiseXQDY0074(per XQuery 3.1 §3.9.3.1) instead ofXPTY0004when the name expression cannot be converted to a valid QName.DynamicAttributeConstructor.java: Same fix for computed attribute constructors (§3.9.3.2).FOCH0002 — Collation errors in fn: functions (~4 tests)
FunSort.java,FunIndexOf.java,FunContainsToken.java: These functions calledcontext.getCollator(uri)which defaults toXQST0076(a static error). Per F&O 3.1 §5.3.4, collation errors from function arguments should raiseFOCH0002(a dynamic error). The fix passes the correct error code, matching whatCollatingFunction.getCollator()already does for other fn: functions.Spec References
Test Plan
misc-CombinedErrorCodestest set — verify ~12 additional tests pass after cherry-pick to next-v3🤖 Generated with Claude Code