Skip to content

t27b: a bench's _ = e; is a discard; ternary_gates' benches type-check once referenced (Closes #8546) - #8616

Merged
gHashTag merged 1 commit into
masterfrom
t27b-8546-bench-type
Oct 10, 2026
Merged

gHashTag merged 1 commit into
masterfrom
t27b-8546-bench-type

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #8546

Part of the t27b coverage epic (see #8326 and #6063). c757043 (see #8195) changed the bench bodies of two specs. After that, t27b refused both with type mismatch.

Cause and fix

arty_a7_integration.t27: a t27b bug.

  • bench_integration_config discards a u32, a u32, then a bool at its top level.
  • specs/tri/t27b/discard_plan.t27 sent every top-level _ = e; in a bench to t27b's test-binding path. That path bound _ as a variable of the first value's type, so it refused the bool: "expected u32, found bool".
  • t27c's gen_bench_block prints each discard as Zig's _ = e;. On the lab, with a test that calls the bench, the generated Zig compiles and passes 7/7.
  • The plan's plan now takes in_bench, and a bench's discards are EVALUATE: compiled and never run, like the rest of a bench body. Two new plan tests cover this. The glue changes one line in cli/t27b/src/lower.rs.

ternary_gates.t27: the spec, not t27b.

  • The new benches are not valid Zig once a test calls them. The reference passed only because nothing calls a bench.
  • With a test that calls them, zig 0.16.0 refuses them three ways:
    • remainder division with 'i32' and 'comptime_int': signed integers and floats must use @rem or @mod, from (result + 1) % 3;
    • an i32 into a u32;
    • tuple field index must be comptime-known, because const vals = [_]i32{...} is printed as a tuple and vals[idx] indexes it at run time.
  • That is the same situation as specs/basics/15_loops.t27, which the ledger records as reference-bug (see specs/basics/15_loops.t27: sum_to does not compile once a test calls it; the lesson passes only because nothing does #7908: it does not compile once called, and nothing calls it). So t27b is not changed here.
  • The fix is in the spec, which is inside the issue's Boundary. The benches now use const vals : [3]i32 and const idx : u32 = @intCast(result + 1); and index with vals[idx % 3]. The generated Zig, with a test that calls all four benches, passes 13/13. That meets specs: bench bodies Zig never type-checks (8 specs reject once referenced) #8195's stated goal: bench bodies type-check once referenced.

Checks on the t27c lab

Check Result
t27b test specs/isa/ternary_gates.t27 --check exit 0: 12 passed, 122 runtime asserts, 7 invariants held
t27b test specs/fpga/boards/arty_a7_integration.t27 --check exit 0: 6 passed, 13 runtime asserts, 7 invariants held
t27c test-report on ternary_gates 12 pass, 0 FAIL, 0 vacuous
t27c test-report on discard_plan 6 pass, 0 FAIL, 0 vacuous
cargo test --release -p t27b (aarch64 under qemu) 158 passed, 0 failed
  • Whole corpus. I ran t27b corpus specs under qemu before and after the change. Only three verdicts changed: the two specs, blocked to pass, and discard_plan, which gained 2 tests. specs/hslm/forward_pass.t27 lost one of its later blocker families; its first blocker is unchanged. pass went from 1257 to 1259 and blocked from 488 to 486. fail stayed at 20 and jit/interp mismatch at 0.
  • Ratchet. I ran tri t27b ratchet against the new ledger, with the reference verdict set by hand for the listed rows. It reports no UNEXPECTED PASS and no OVER CAP. It does report 7 UNEXPECTED FAILURE rows, all qemu timeouts that also time out on master's binary.
  • Own-language gates. master's own_language.c gives check_budget exit 0 and check_all exit 0. Net hand lines: 0 (lower.rs +1 -1).
  • Seals. t27c seal --save was run for ternary_gates and discard_plan. gen/rust/tri/t27b/discard_plan.rs was regenerated with t27c gen-rust.

Ledger: both rows are back to {"path": ..., "t27b": "pass"}, and max_not_pass goes from 27 to 25.

Generated with Claude Code

…e-check once referenced (Closes #8546)

c757043 (see #8195) changed the bench bodies of two specs. After that,
t27b refused both with `type mismatch`.

- arty_a7_integration.t27: bench_integration_config discards a u32, a
  u32, then a bool at its top level. discard_plan.t27 sent every
  top-level `_ = e;` in a bench to t27b's test-binding path. That path
  bound `_` as a variable of the first value's type, so it refused the
  bool. t27c's gen_bench_block prints each one as Zig's `_ = e;`, and
  Zig compiles the bench once a test calls it (checked on the lab). The
  plan's `plan` now takes `in_bench`, and a bench's discards are
  EVALUATE. Two new tests cover this; the glue changes one line.
- ternary_gates.t27: t27b was right to refuse it. Once a test calls its
  benches, zig 0.16 refuses them three ways: `(result + 1) % 3` is a
  signed `%`, an i32 into a u32, and `vals[idx]` indexes a tuple at run
  time. The reference passed only because nothing calls a bench (see
  #7908 for the same case in a fn). The benches now use a `[3]i32` and
  `@intCast(result + 1)`. With a test that calls all four benches, the
  generated Zig passes 13/13.

Ledger: both rows are back to pass, and max_not_pass goes from 27 to 25.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) October 10, 2026 13:43
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-10 13:43:16 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e2e342a729fe != 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.

t27b: ternary_gates and arty_a7_integration block on 'type mismatch' after c7570433e made their bench bodies type-check

2 participants