Skip to content

gen-c: type a list of calls from the return-type map - #3465

Merged
gHashTag merged 1 commit into
masterfrom
c/literal-list-calls
Sep 8, 2026
Merged

gen-c: type a list of calls from the return-type map#3465
gHashTag merged 1 commit into
masterfrom
c/literal-list-calls

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 8, 2026

Copy link
Copy Markdown
Owner

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:

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 far larger than
the class I have been following for three passes:

class count
use of undeclared identifier 3007
call to undeclared function 2057 (91 files)
unknown type name 848
total 5912
…against the __auto_type class 522

More 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:

[]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 — -ferror-limit=0

before after
errors 14041 14040
__auto_type class 523 522
files better / worse 1 / 0

One error. Stated as one.

It is a lookup, not a guess

input result
[cast_i8(1), cast_i8(2)] int8_t x[2]
calls with disagreeing return types refused
a function this module does not declare refused
a mixed literal-and-call list refused
a call returning []i32 refused
mutant dead tests
call path closed 1
composite returns taken verbatim 1
disagreement ignored 1

Full suite: 2647 passed, 0 failed. 3 seals refreshed in the same commit.

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
gHashTag enabled auto-merge (squash) September 8, 2026 06:45
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 6cc00ff into master Sep 8, 2026
29 of 33 checks passed
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-08 06:45:33 UTC

Summary

Status Count
Total Open PRs 15
PRs with Failing Checks 13
PRs with All Checks Green 2
READY 2
FAILING 13
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ef36d26b7f0e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant