Skip to content

feat(t27b): lower try std.testing.* statements in tests like the reference - #6355

Merged
gHashTag merged 1 commit into
masterfrom
claude/t27b-trystmt
Oct 5, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/t27b-trystmt

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #6354
Refs #6063

try std.testing.expect / expectEqual / expectApproxEqAbs(...); as a statement in a test now lowers in cli/t27b/src/lower.rs. Per-test verdicts equal the reference (t27c gen + zig test, zig 0.16):

  • A failed check fails only that test, and later tests still run.
  • expectEqual uses peer types, and floats compare as IEEE values.
  • expectApproxEqAbs follows std.math.approxEqAbs: a negative tolerance panics and fails the test, a == b passes (equal infinities pass), NaN fails, and each operand is evaluated once, left to right.
  • try in a bench, or in a fn nothing analyzed reaches, lowers to a stub trap, because Zig never analyzes those bodies.

Named refusals, each confirmed BLOCKED under t27c test-report:

  • ExprUnary(try) in an invariant: t27c emits an invariant as a comptime block, and Zig reports "'try' outside function scope".
  • ExprUnary(try) in a fn: the fn gets a void/non-error return type in the reference.
  • ExprUnary(try) on a non-error call.
  • ExprCall(std.testing.expectApproxEqAbs) on comptime floats and on a non-float.
  • ExprUnary(try) std.testing.<other>.

#6353's ignored-result rule is unchanged.

Corpus vs reference (t27b corpus specs --blockers --reference t27c, fixed binaries, base fefecd8)

before after
pass 357 361
pass_vacuous 285 286
fail 9 9
rejected 564 559
front-end error 40 40
mismatch 0 0
timeout 2 2
counted /720 629 634
  • Newly passing: specs/base/seed, brain/bus, brain/cognitive_loop, brain/phi_timing, numeric/trinity_numeric_surface (pass_vacuous: its only check compares two consts, which folds at compile time).
  • No file changed verdict otherwise. Every remaining try blocker is in a file the reference itself blocks.
  • Greedy top 5 after (reference-backed): StmtExpr +4, type f32 +3, type ?T +2, ExprLiteral(null) +12, ExprArrayLiteral +5.

Tests

cli/t27b/tests/source.rs adds try_statements_in_tests_match_the_reference and try_statements_the_reference_does_not_compile_are_refused. Their verdicts were checked against t27c test-report on the same sources. cargo test -p t27b is green.

Reference bug seen: try h() on a void fn makes zig 0.16 report "not yet implemented" rather than a type error. It is BLOCKED either way.

🤖 Generated with Claude Code

…rence

`try std.testing.expect / expectEqual / expectApproxEqAbs(...);` in a test
lowers to asserts whose trap fails that test alone, as the error the
reference's Zig test returns does. approxEqAbs follows Zig 0.16: a negative
tolerance panics, equal values pass, NaN fails, operands evaluated once.
`try` in a bench or an unreached fn is a stub trap (never analyzed). Forms
the reference cannot compile get named refusals, each confirmed BLOCKED
under t27c test-report.

Corpus vs reference at fefecd8: counted pass 629 -> 634 of 720, checked
pass 357 -> 361, mismatch 0, no regression.

Closes #6354

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

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 03:48:01 UTC

Summary

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

These columns do not partition: 11 + 34 + 0 + 0 = 45, and there are 46 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 d8375ad into master Oct 5, 2026
28 of 30 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 try std.testing.* statements in tests (blocker ExprUnary(try) statement)

1 participant