tools: a parity table for builtin call spellings - #3500
Merged
Conversation
Closes #3499 Five defects this campaign shared one shape -- a rule present in three backends and missing from the fourth: Type.member / Type::member gen-c had no answer #3467 #3469 `.` versus `->` gen-c had no answer #3477 a brace literal as a value gen-c had no answer #3475 #3492 `s.len` on a string gen-c had no answer #3489 cast_iN(x) gen-c had no answer #3497 The cause is structural: FOUR INDEPENDENT AST-TO-TEXT EMITTERS, so a lowering written in one cannot reach the others and the class recurs by construction. Each was found by accident and cost a full pass. `backend_parity_table.py` already asks this about DECLARATION FORMS. This asks it about CALLS -- the other axis -- and printed the sixth instance on its first run: call uses specs C Rust Zig abs(v) 392 45 passthrough (v).abs() @abs(v) round(v) 136 38 passthrough (v).round() @round(v) sqrt(v) 100 25 passthrough (v).sqrt() @sqrt(v) floor(v) 98 15 passthrough (v).floor() @floor(v) max(v, v) 51 26 passthrough (v).max(v) @max(v, v) min(v, v) 19 12 passthrough (v).min(v) @min(v, v) sign(v) 63 48 passthrough passthrough passthrough 796 uses across 45+ specs. `sign` is the other kind of row: nobody lowers it, which is a question for the language rather than a backend. FOR THREE OF THE SIX THE SPELLING WAS NEVER WRONG. `sqrt(x)` IS C, and the only thing missing was `<math.h>`; the whole repair is a conditional include, decided the way `<string.h>` and `<assert.h>` already are. errors 10 831 -> 10 811 (-20) files better/worse 10 / 0 headers with math.h 0 -> 10 `abs` IS DELIBERATELY EXCLUDED, and the reason is the shape this campaign has refused four times: C has `abs` for int and `fabs` for double, and choosing without the argument's type is a silent truncation. `min` and `max` are not C functions at all. IT CANNOT BE A GATE. A blank column is not a defect by itself: `print` has no business in synthesizable Verilog and the float cast is refused deliberately in three backends. The table proposes; a person concludes. AND THE READER WAS WRONG ONCE, in exactly the way its sibling's docstring records: the first version read Zig's `@abs(v)` as passthrough -- `abs(` occurs inside it -- and called six lowered rows missing, a failure of the instrument printed as a fact about the backend. The `@` is in the lookbehind now, and the self-check asserts that case. Tests: 5 new, full suite 3563 passed 0 failed. Five mutants, all killed, including the two that widen or narrow the recognised set. 10 stale seals refreshed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
September 8, 2026 13:47
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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.
tools: a parity table for builtin call spellings
Closes #3499
Five defects this campaign shared one shape -- a rule present in three
backends and missing from the fourth:
Type.member / Type::member gen-c had no answer #3467 #3469
.versus->gen-c had no answer #3477a brace literal as a value gen-c had no answer #3475 #3492
s.lenon a string gen-c had no answer #3489cast_iN(x) gen-c had no answer #3497
The cause is structural: FOUR INDEPENDENT AST-TO-TEXT EMITTERS, so a
lowering written in one cannot reach the others and the class recurs by
construction. Each was found by accident and cost a full pass.
backend_parity_table.pyalready asks this about DECLARATION FORMS.This asks it about CALLS -- the other axis -- and printed the sixth
instance on its first run:
call uses specs C Rust Zig
abs(v) 392 45 passthrough (v).abs() @abs(v)
round(v) 136 38 passthrough (v).round() @round(v)
sqrt(v) 100 25 passthrough (v).sqrt() @sqrt(v)
floor(v) 98 15 passthrough (v).floor() @floor(v)
max(v, v) 51 26 passthrough (v).max(v) @max(v, v)
min(v, v) 19 12 passthrough (v).min(v) @min(v, v)
sign(v) 63 48 passthrough passthrough passthrough
796 uses across 45+ specs.
signis the other kind of row: nobodylowers it, which is a question for the language rather than a backend.
FOR THREE OF THE SIX THE SPELLING WAS NEVER WRONG.
sqrt(x)IS C, andthe only thing missing was
<math.h>; the whole repair is a conditionalinclude, decided the way
<string.h>and<assert.h>already are.errors 10 831 -> 10 811 (-20)
files better/worse 10 / 0
headers with math.h 0 -> 10
absIS DELIBERATELY EXCLUDED, and the reason is the shape thiscampaign has refused four times: C has
absfor int andfabsfordouble, and choosing without the argument's type is a silent
truncation.
minandmaxare not C functions at all.IT CANNOT BE A GATE. A blank column is not a defect by itself:
printhas no business in synthesizable Verilog and the float cast is refused
deliberately in three backends. The table proposes; a person concludes.
AND THE READER WAS WRONG ONCE, in exactly the way its sibling's
docstring records: the first version read Zig's
@abs(v)as passthrough--
abs(occurs inside it -- and called six lowered rows missing, afailure of the instrument printed as a fact about the backend. The
@is in the lookbehind now, and the self-check asserts that case.
Tests: 5 new, full suite 3563 passed 0 failed. Five mutants, all killed,
including the two that widen or narrow the recognised set. 10 stale
seals refreshed.
🤖 Generated with Claude Code