Retire the byte-for-byte fidelity constraint, and fix what it was blocking
The Go reference is deprecated and will not be updated, so the two projects are no longer required to match. Recorded as TODO.md section 0.1, first thing in the file, because it silently reverses the premise several later sections were written on -- an agent reading section 6 without it will park work that is no longer blocked. Section 6 item 16 was the item waiting on exactly this and is now fixed: the keyword tables are searched on the base name with any type suffix stripped, so PRINT$, LEN# and GOTO% are refused as variable names and the reference's own diagnostic stops being dead code. It cost the one golden case predicted, and the cost was nothing -- renaming a variable in strreverse.bas left its expected output byte-for-byte unchanged. AKBASIC_KNOWN_FAILING_TESTS is empty as a result and known_reference_defects.c is gone. Section 6 items 1-9 and 11 are reopened as an ordinary defect list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -150,15 +150,32 @@ int main(void)
|
||||
TEST_REQUIRE_INT(env()->lineno, 10);
|
||||
|
||||
/*
|
||||
* The "Reserved word in variable name" check never fires: the lexeme still
|
||||
* carries its suffix when the verb table is searched, so "PRINT$" misses and
|
||||
* becomes an ordinary string variable. Pinned as it stands -- TODO.md
|
||||
* section 12 item 16.
|
||||
* A verb name with a type suffix stuck on it is refused as a variable name.
|
||||
* The reference searches the keyword tables with the suffix still attached
|
||||
* (basicscanner.go:349), so "PRINT$" misses every table, its own "Reserved
|
||||
* word in variable name" diagnostic is dead code, and `PRINT$ = 1` is
|
||||
* quietly accepted. TODO.md section 6 item 16; this is its regression test.
|
||||
*/
|
||||
HARNESS_RUNTIME.hasError = false;
|
||||
TEST_REQUIRE_OK(akbasic_scanner_scan(&HARNESS_RUNTIME, "PRINT$ = 1", NULL, 0));
|
||||
TEST_REQUIRE(!HARNESS_RUNTIME.hasError,
|
||||
"PRINT$ is currently accepted as a variable name; see TODO.md 12.16");
|
||||
expect_token(0, AKBASIC_TOK_IDENTIFIER_STRING, "PRINT$");
|
||||
TEST_REQUIRE(HARNESS_RUNTIME.hasError, "PRINT$ must be refused as a variable name");
|
||||
|
||||
/* The same for a function name, and for the other two suffixes. */
|
||||
HARNESS_RUNTIME.hasError = false;
|
||||
TEST_REQUIRE_OK(akbasic_scanner_scan(&HARNESS_RUNTIME, "LEN# = 1", NULL, 0));
|
||||
TEST_REQUIRE(HARNESS_RUNTIME.hasError, "LEN# must be refused as a variable name");
|
||||
HARNESS_RUNTIME.hasError = false;
|
||||
TEST_REQUIRE_OK(akbasic_scanner_scan(&HARNESS_RUNTIME, "GOTO% = 1", NULL, 0));
|
||||
TEST_REQUIRE(HARNESS_RUNTIME.hasError, "GOTO%% must be refused as a variable name");
|
||||
|
||||
/*
|
||||
* And an ordinary name that merely *contains* a verb is still fine, which is
|
||||
* what says the check compares the whole base name rather than a prefix.
|
||||
*/
|
||||
HARNESS_RUNTIME.hasError = false;
|
||||
TEST_REQUIRE_OK(akbasic_scanner_scan(&HARNESS_RUNTIME, "PRINTER$ = 1", NULL, 0));
|
||||
TEST_REQUIRE(!HARNESS_RUNTIME.hasError, "PRINTER$ is not a reserved word");
|
||||
expect_token(0, AKBASIC_TOK_IDENTIFIER_STRING, "PRINTER$");
|
||||
|
||||
/* An unknown character is diagnosed. */
|
||||
HARNESS_RUNTIME.hasError = false;
|
||||
|
||||
Reference in New Issue
Block a user