Skip to content

#2358: Sema refuses a builtin call outside its declared BuiltinSigs arity - #2378

Merged
ehartford merged 1 commit into
mainfrom
fix-2358-builtin-arity
Oct 13, 2026
Merged

ehartford merged 1 commit into
mainfrom
fix-2358-builtin-arity

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Fixes #2358.

A builtin method call whose argument count fell outside the signature its BuiltinSigs row declares (D110) was never checked in Sema: an extra argument reached MIR lowering and aborted it (exit 134, s.find("b", 2), s.len(1), xs.push(1, 2), …), and a missing one compiled silently (s.find(), xs.push(), m.insert(k)); a.store() even stored the SeqCst constant MirLower materializes for an omitted Ordering.

Sema now checks the resolved count at the call against the row it already resolves: required..=total, where required excludes an Atomic method's omittable trailing Ordering parameters (§14.17.1, #1861 — behav_1861_atomic_default_ordering still passes). A builtin with no row takes no arguments; a float math method takes arity−1 because its receiver is the first operand (the free form already checked; x.sqrt(2.0) silently ignored the operand).

Five test/compile_errors/err_2358_* fixtures pin the class; each ICE'd or passed silently before. The find(needle, from) enhancement the original script wanted is filed separately as #2377 (needs spec words).

Iterate-tier evidence: stage1 (:dev) checks all five fixtures to the exact expected diagnostics, the full 30-case wrong-arity matrix flips from ICE/silent-ok to rc=1 diagnostics with legal forms unchanged, census --diff clean. Gate/battery evidence to follow on this PR.

…s declared BuiltinSigs row

An extra argument reached MIR lowering and aborted it (BUG, exit 134:
s.find(needle, from), s.len(1), xs.push(1, 2), ...); a missing one
compiled silently (s.find(), xs.push(), m.insert(k)) and a.store()
stored the SeqCst constant MirLower materializes for an omitted
Ordering. The row Sema already resolves for the call (D110) now also
bounds the count: required..=total, where required excludes an Atomic
method's omittable trailing Ordering parameters (§14.17.1, #1861).
A builtin with no row takes no arguments; a float math method takes
arity-1 (its receiver is the first operand), matching the free form's
existing check. Five compile-error fixtures pin the class; each ICE'd
or passed silently before this change.
@ehartford

Copy link
Copy Markdown
Contributor Author

Gate GREEN on 4079d1e (seed-driven src/main build :gate, 2026-10-12): fix2358-gate1.log: rc=0 green. This is the bottom layer of a stack; the D119 Amendment 1 layer (#2311) goes on top and one battery will bless the stack top.

@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on stack top 975e66f (seed-driven, with run tools/battery.w, 2026-10-12):

975e66f6d /Users/eric/.local/with-staging/d119a1
gate rc=0 wall=124s
uat rc=0 wall=29s
battery-checks rc=0 wall=1428s
GREEN
battery: GREEN (975e66f6d); logs in out/battery/

One battery blesses the whole stack (#2378 + #2380).

@ehartford
ehartford marked this pull request as ready for review October 13, 2026 05:08
@ehartford
ehartford merged commit 190f9c4 into main Oct 13, 2026
@ehartford
ehartford deleted the fix-2358-builtin-arity branch October 13, 2026 05:09
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.

ICE: s.find(needle, from) on a str reaches MIR with no declared signature (BUG, exit 134) instead of a diagnostic

1 participant