t27b: assert(cond, "msg") lowers like the reference (+19 files) - #6306
Merged
Merged
Conversation
t27c's Zig backend emits `assert(cond, "msg")` as `if (!(cond)) @Panic("msg")` and never evaluates the message, so the verdict is the one-argument assert's. t27b now lowers a string-literal message form exactly like `assert(cond)`. A non-literal message is refused as ExprCall(assert with non-literal message); three or more arguments stay ExprCall(assert with message). t27b corpus specs: pass 258 -> 277, rejected 670 -> 651, mismatch 0. All 19 newly passing files agree with t27c test-report from the same master. Closes #6305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6305
Refs #6063
What
assert(cond, "msg")was rejected asExprCall(assert with message)-- step 1 of the greedy order at master 7e69777 (+19 files). t27c's Zig backend (gen_expr, thenode.name == "assert"arm) emitsif (!(cond)) @panic("msg")and never evaluates the message, so t27b now lowers a string-literal message form exactly likeassert(cond).Refused by name, never guessed:
ExprCall(assert with non-literal message)(0 specs today)ExprCall(assert with message)(0 specs today)t27b corpus specs(local, master 7e69777 vs this branch, load ~13)The 6 failing and 3 timing-out files are the same before and after.
Reference check
Every newly passing file was run through
t27c test-reportbuilt from the same master (7e69777); all agree test for test (tests / pass / FAIL):specs/compiler/rust_constant_case.t272/2/0,specs/numeric/bnf{8,16,32,64,128,256,512,1024}.t272/2/0 each,specs/numeric/gft{4,8,16,32}.t272/2/0 each,specs/numeric/tnf{4,8,32}.t272/2/0 each,specs/numeric/tnf{16,64,128}.t274/4/0 each.Tests
cargo test -p t27bgreen. Newassert_with_message_checks_the_condition_only(cli/t27b/tests/source.rs): a passing test, a failing one (trap at the assert's line, JIT and interpreter agree) and an invariant with a message, plus the non-literal refusal. The same spec throught27c test-reportgives pass 1 / FAIL 1 / invariant proved -- the same verdicts.docs/reports/t27b_expectations.jsonis not touched here: like #6296, the steward re-blesses it from a lab run on master.Top 5 blockers after (greedy)
🤖 Generated with Claude Code