gen-c: type a list of calls from the return-type map - #3465
Merged
Conversation
Refs #3459, #3464 I set out to type lists of calls, estimating ~92 errors from the shape count. The change removes ONE, and the reason is the finding rather than the fix: grep -rl 'cast_i8(' specs/ | wc -l # 6 specs call it grep -rl 'fn cast_i8' specs/ | wc -l # 0 declare it `fn_return_types` has no entry, so the lookup correctly refuses. The refusal is right; the missing declaration is the defect, and it is much larger than the class I have been following: use of undeclared identifier 3007 call to undeclared function 2057 (91 files) unknown type name 848 ---- 5912 against 522 remaining __auto_type More than ten times larger, and uncounted for three passes because I was following one class rather than reading the distribution. Filed as #3464. THE CHANGE INTRODUCED A DEFECT AND THE CORPUS CAUGHT IT. Taking the return type verbatim emitted `[]Trit structures[2] = { ... }` -- t27 syntax in a C declarator, two errors where there had been one. An array, slice, optional or pointer needs declarator machinery this branch does not have, and `__auto_type` is the better answer until it does. Composite return types are now refused, and a test holds it. Measured, whole corpus, -ferror-limit=0: errors 14041 -> 14040, the `__auto_type` class 523 -> 522, one file better and NONE worse. One error, stated as one. The inference is a lookup and not a guess: a call to a function this module does not declare is refused, a list whose calls disagree on their return type is refused, and a mixed literal-and-call list is refused. Three mutants, three dead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
September 8, 2026 06:45
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
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.
Refs #3459 · surfaces #3464
I set out to type lists of calls, estimating ~92 errors from the shape
count. The change removes one — and the reason is the finding, not the fix:
fn_return_typeshas no entry, so the lookup correctly refuses. The refusal isright; the missing declaration is the defect — and it is far larger than
the class I have been following for three passes:
use of undeclared identifiercall to undeclared functionunknown type name__auto_typeclassMore than ten times larger, and uncounted because I was following one class
rather than reading the distribution. Filed as #3464.
The change introduced a defect and the corpus caught it
Taking the return type verbatim emitted:
t27 syntax in a C declarator — two errors where there had been one. An
array, slice, optional or pointer needs declarator machinery this branch does
not have, and
__auto_typeis the better answer until it does. Compositereturn types are now refused, and a test holds it.
Measured —
-ferror-limit=0__auto_typeclassOne error. Stated as one.
It is a lookup, not a guess
[cast_i8(1), cast_i8(2)]int8_t x[2][]i32Full suite: 2647 passed, 0 failed. 3 seals refreshed in the same commit.