Skip to content

feat(t27b): undefined; stub in a fn the reference never analyzes - #6309

Merged
gHashTag merged 1 commit into
masterfrom
claude/t27b-identstmt
Oct 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/t27b-identstmt

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Closes #6308
Refs #6063

What

t27b corpus specs --blockers at master 0851055 ranked ExprIdentifier statement first in the greedy order (+19 files). Its dominant shape is undefined; as a statement, the body stub a port leaves where plumbing was.

What the reference does: t27c's Zig backend emits undefined; unchanged. Zig rejects it ("value of type '@typeof(undefined)' ignored") only in a fn its lazy analysis reaches. Under zig test, neither pub nor main is a root, so a stub that nothing analyzed names never stops the file, and every test runs.

What t27b does now:

  • analyzed_fns computes the fns that a test, an invariant (emitted as a comptime block), a bench or a module-level declaration can reach by name, followed to a fixed point. It over-approximates: any name in a reached body counts.
  • In a fn outside that set, undefined; lowers to a trap (TrapKind::Stub) that no test can hit.
  • Anywhere else it is refused as ExprIdentifier(undefined) statement. The reference reports BLOCKED (does not compile) there too. Checked on scratch specs and on 3 corpus files: link_relay.t27 and read_user1.t27 fail on this error, and migrate.t27 on an earlier one.

Left under the old name ExprIdentifier statement (different shapes, not this PR): Rust-style tail expressions (fn f(v: u8) -> u32 { v }; 17 files, e.g. bigint, radix_economy, rust_tail_returns) and given/when prose.

Corpus (t27b corpus specs, local, master 0851055, load ~10)

before after
pass 277 296
pass_vacuous 279 279
fail 6 6
rejected 652 633
front-end error 40 40
JIT/interpreter mismatch 0 0
timeout 3 3

Every one of the 19 newly passing files agrees test for test with t27c test-report, built from the same master. All tests pass in both, with the same counts: retry 5, bulk-create-notebooks 5, gen_w365 3, gen_w388_lean 11, gen_w391_lean 13, gen_w631 6, print_pellis_seal_decimal 4, run_v51_multiple 1, verify_precision 7, check_fix_carries_source 6, run_conformance_vvp 6, railway_null_startcmd 8, ad9361_config 5, roster 3, stash 4, trios-golden-float/build 6, trios-hdc/build 1, SR-02/lib 2, trios-physics/build 4.

Top first-rejection blockers after: type f32 (71), type ?T (52), type std.mem.Allocator (45), type (undeclared) (39), type [N]T (39). Greedy order after: FnDecl +15, ExprBinary statement +12, ExprCall(@compileAssert) +9.

Tests

undefined_stub_only_where_zig_never_looks in cli/t27b/tests/source.rs:

  • Stubs reached only from main still run both tests: one passes and one fails, the same as t27c test-report (1/2).
  • Three reached shapes are refused: through another fn on a branch no test takes, from an invariant, and directly in a test. The reference does not compile the first two shapes (checked).

cargo test -p t27b: all suites green.

The ratchet ledger docs/reports/t27b_expectations.json is not touched here. It is blessed from a lab run on master.

🤖 Generated with Claude Code

t27c's Zig backend emits `undefined;` as is, and Zig rejects it only in
a fn its lazy analysis reaches; under `zig test` neither `pub` nor
`main` is a root. t27b now computes, by name, the fns a test,
invariant, bench or module-level declaration can reach (an
over-approximation), lowers `undefined;` outside them to a trap no test
can hit (TrapKind::Stub), and refuses it inside them as
ExprIdentifier(undefined) statement, where the reference does not
compile either.

t27b corpus specs at master 0851055: pass 277 -> 296, rejected
652 -> 633, mismatch 0. All 19 newly passing files agree test for test
with t27c test-report from the same master.

Closes #6308

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 23:54:06 UTC

Summary

Status Count
Total Open PRs 45
PRs with Failing Checks 33
PRs with All Checks Green 12
READY 11
FAILING 33
PENDING 0
NO CHECKS YET 0

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

Seal Status

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

@gHashTag
gHashTag merged commit 1318adf into master Oct 4, 2026
29 of 31 checks passed
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: lower an undefined; body stub the reference never analyzes

1 participant