Skip to content

t27b: return undefined in a void fn is a plain return (Closes #7402) - #7442

Merged
gHashTag merged 8 commits into
masterfrom
claude/t27b-lane1-ret
Oct 7, 2026
Merged

gHashTag merged 8 commits into
masterfrom
claude/t27b-lane1-ret

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Refs #6063. Closes #7402.

What

Ported specs end a -> void fn with return undefined; (a deinit that frees nothing, an early exit). In Zig undefined coerced to void is the one void value, so the statement is a plain return;. t27b now lowers it that way instead of refusing it as ExprReturn. Inside a test block it stays refused: there the Zig result is an error union, and an undefined one is no value t27b can name.

Conformance first

specs/tri/t27b/conformance/return_undefined_void.t27, 4 tests: the work before the statement is kept, the work after it is skipped, in a branch, at the end of a body, and alone in a fn that is called or not. Reference: 4 pass, 0 vacuous. t27b: the same 4.

  • 5 mutants of the spec: each fails the same tests in t27b and in the reference.
  • 10 probes: 5 pass in both, 1 fails in both, 1 blocked in both, 1 (in a test block) an honest t27b refusal, 1 (a non-void fn returning undefined) refused by t27b where the reference passes 0 tests.

Disclosed gap

A statement after return undefined; is unreachable code, which the reference refuses to compile; t27b runs the file. t27b does not check unreachable code in general, so this gap is older than this family; it is not widened here beyond the new statement.

Numbers

  • cargo test -p t27b on the lab: all suites pass.
  • Lab corpus at 74b0689 vs master 05e633d (--jobs 2): mismatch 0, crash 0, timeout 2 (the same load-bound timeouts as other lane runs). t27b passes 827 reference-pass files, up from 823: gen_ring_buffer.t27, gen_rtree.t27, gen_wal.t27 (blocked -> pass) and the new conformance spec. gen_work_stealing.t27 gets past ExprReturn and now stops at codegen FnDecl(frame size) (16448 bytes of local aggregates; the limit is 16384). No file regressed. No interpreter fallback, no skipped tests.
  • Ledger (docs/reports/t27b_expectations.json): the four files above added as pass, gen_work_stealing -> codegen FnDecl(frame size). Recounted: pass 533 -> 537, pass_vacuous 262, not_pass 25. No duplicate paths.

Foreign code

cli/t27b/src/lower.rs and cli/t27b/tests/source.rs are Rust. The owner approved foreign Rust in cli/t27b for #6063 and asked agents to set the owner-approved-foreign label themselves ("add the label yourself and do the foreign part", translated). Both files are listed in tools/policy/foreign-exceptions.txt.

NOW entry: docs/now/2026-10-07-t27b-return-undefined.md.

Foreign-line budget (#7371)

Master's check_budget() on git diff --numstat origin/master...HEAD: allowed (exit 0). cli/t27b/src/lower.rs +9, cli/t27b/tests/source.rs +39, total 48 of 80. The Rust test first had 45 lines; the release-only case was dropped from it because return_undefined_void.t27 already checks that shape against the reference (re-run on the lab: return_undefined_in_a_void_fn ... ok).

🤖 Generated with Claude Code

gHashTag and others added 2 commits October 7, 2026 15:56
In Zig undefined coerced to void is the one void value, so the fn stops
there and the caller goes on. Conformance spec first:
specs/tri/t27b/conformance/return_undefined_void.t27. In a test block the
statement stays refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gen_ring_buffer, gen_rtree, gen_wal and return_undefined_void are added as
pass; gen_work_stealing now stops at codegen FnDecl(frame size). Lab corpus
against master 05e633d: mismatch 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not in Rust (Closes #7402)

The owner's foreign-line budget (#7371) caps a file at 40 added lines.
return_undefined_void.t27 already checks a fn whose body is only
`return undefined;` against the reference, so the Rust copy goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 7, 2026
@gHashTag
gHashTag merged commit 5e8c456 into master Oct 7, 2026
40 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27b: return undefined in a void fn is a plain return (lane 1, ExprReturn)

1 participant