Skip to content

t27b: @compileAssert as assert, integer as f64 as @floatFromInt (+10 counted) - #6322

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

gHashTag merged 1 commit into
masterfrom
claude/t27b-compileassert

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #6319
Refs #6063

What

  • @compileAssert(cond[, "msg"]) lowers through the same arm as assert in cli/t27b/src/lower.rs. The reason: t27c's Zig backend does exactly that (node.name == "@compileAssert" || node.name == "assert" in bootstrap/src/compiler.rs). It emits if (!(cond)) <fail>. Inside an invariant (a comptime block) a false condition fails the compile. Inside a test it is a runtime check.
  • x as f64 with an integer x lowers as @floatFromInt with result type f64. The reference emits @as(f64, @floatFromInt(x)) for it (is_float_expr false). A float or bool operand, and f64 as an integer, stay refused as ExprCast(f64).

The lab (0851055) listed ExprCall(@compileAssert) as the only blocker on 9 specs the reference passes. That list was incomplete. With @compileAssert lowered, all 9 stopped next at EXP_BITS as f64, so this PR also covers that second blocker.

Verdicts vs the reference (mutation control)

Shape reference (t27c test-report) t27b
true @compileAssert in invariant / test pass pass
false @compileAssert in a test that test FAIL (1 of 2) that test FAIL (1 of 2)
false @compileAssert in an invariant (int and f64 operands, mutated gf10) BLOCKED: error: assertion failed (comptime) invariant broken, exit 1 (TESTFAIL)

Neither path passes a file with a false invariant. The failure class is different, though: the reference fails to compile, t27b fails at run time. assert in an invariant already behaves this way in t27b. Fixing it would need a "does not compile" outcome in t27b, which is out of this PR's scope.

Corpus (t27b corpus specs --blockers --reference <t27c built from 65e6ddba3>, local, load 7-36)

before (65e6ddb) after
pass (checked) 311 321
pass_vacuous 283 283
fail 6 6
rejected 614 604
front-end error 40 40
mismatch 0 0
timeout 3 3
reference pass 720 720
t27b checked pass where the reference passes 307 317
t27b pass where the reference does not 12 12

Counted gain: +10. The 9 specs/numeric/gf{6,10,14,48,96,128,256,512,1024}.t27 (4-6 invariants each, now run) plus specs/queen/task_analysis.t27 (priority as f64). All 10 are reference-pass and t27b pass. JIT and interpreter agree.

Reference-backed greedy top 5 after: ConstDecl(str field) +5, ExprLiteral(char literal) +4, ExprIf +5, StmtExpr +4, ExprArrayLiteral +4.

Tests

  • compile_assert_is_assert (cli/t27b/tests/source.rs) covers true and false, invariant and test, f64 operands from integer casts, and the message rule. Its source was also run through t27c test-report. With the broken invariant it is BLOCKED; without it, 1 of 2 tests fail. Both match.
  • f64_refusals_name_the_construct now refuses x as f64 (f64 operand), x as i32 and (n > 0) as f64 by name.
  • cargo test -p t27b: all green.

🤖 Generated with Claude Code

…atFromInt

ExprCall(@compileAssert) was the only listed lab blocker on 9 specs the
reference passes (specs/numeric/gf{6,10,14,48,96,128,256,512,1024}.t27).
t27c's Zig backend lowers `@compileAssert` through the same arm as
`assert` (`if (!(cond))`; a false one fails the compile inside an
invariant's comptime block and is a runtime check inside a test), so
t27b now does the same, with the same string-literal message rule.

The 9 files then stopped at `EXP_BITS as f64`. The reference emits
`@as(f64, @floatFromInt(x))` for an integer operand, so an integer
`as f64` now lowers as @floatFromInt with result type f64. Float or
bool `as f64` and f64 `as` an integer stay refused as ExprCast(f64).

t27b corpus specs --reference (t27c built from 65e6ddb): checked
passes among the 720 reference passes 307 -> 317 (the 9 gf files and
specs/queen/task_analysis.t27), mismatch 0, no new pass where the
reference fails.

Closes #6319

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 00:58:04 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 e8513e0 into master Oct 5, 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 @compileAssert (as assert) and integer as f64 (as @floatFromInt)

1 participant