Repository navigation
fix(builtins): ERRORCODE returns a LONG, FILEERRORCODE a STRING - #871
Merged
msarson merged 1 commit intoNov 25, 2026
Merged
Conversation
clarion-builtins.json had the two return types swapped. The hover card on `IF ERRORCODE() = 0` said the code came back "as a string" and was "empty string if no error", and the signature read ERRORCODE() -> STRING. Language Reference: ERRORCODE() returns a LONG, zero when no error was posted; FILEERRORCODE() returns a STRING with the file driver's native error code, valid only when ERRORCODE() = 90 or 47. Both entries now say so. Test: BuiltinErrorCodeReturnType.test.ts, 3 tests (signature labels, descriptions, the hover card); all 3 fail against the old data. Server suite: 4622 passing, 3 pending. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
ERRORCODE returns a LONG, FILEERRORCODE a STRING (they were swapped)
What happened
Hovering
ERRORCODEinshowed:
and signature help read
ERRORCODE() → STRING. ERRORCODE returns a number, and the very line it is hovered on compares it with0.Root cause
server/src/data/clarion-builtins.jsonhad the return types of ERRORCODE and FILEERRORCODE swapped:{ "name": "ERRORCODE", ... "returnType": "STRING", "description": "Returns the error code number as a string ... Returns empty string if no error. ..." } { "name": "FILEERRORCODE", ... "returnType": "LONG", "description": "Returns the file driver-specific error code as a numeric value. ..." }The Language Reference says the opposite:
The fix
Both entries now carry the documented type and wording:
{ "name": "ERRORCODE", ... "returnType": "LONG", "description": "Returns the code number for any error that was posted (for example by OPEN, GET or ADD). Returns zero if no error was posted. Check it immediately after the statement that may post an error: any later statement that can post an error clears it." } { "name": "FILEERRORCODE", ... "returnType": "STRING", "description": "Returns a string containing the code number of the native error from the file system (file driver) used to access the data file. Valid only when ERRORCODE() = 90 or ERRORCODE() = 47." }No code depends on either return type (checked: the only other references are the grammar's built-in list, the undeclared-variable built-in list and tests).
Testing
server/src/test/BuiltinErrorCodeReturnType.test.ts, 3 tests:ERRORCODE() → LONGwith "zero" and no "string" in its description;FILEERRORCODE() → STRINGwith the 90 / 47 condition; and a real hover onIF ERRORCODE() = 0that must say "zero" and must not say "as a string" / "empty string".clarion-builtins.jsoninout/, all 3 fail.Scope
Only these two entries.
ERROR()says "from the most recent file operation", which is narrower than the Language Reference ("any error that was posted"), but it is not wrong about the type, so I left it.🤖 Generated with Claude Code