astgen: fix while loop dbg_node, block expr rvalue, int_type data issue

- whileExpr: emit emitDbgNode before condition evaluation to match
  upstream AstGen.zig:6579. Fixes astgen_test.zig corpus (1 missing
  DBG_STMT).
- Block expressions in exprRl: wrap blockExprExpr result with rvalue()
  to handle result location storage (RL_PTR → STORE_NODE, etc.).
  Fixes parser_test.zig inst_len to exact match.
- parser_test.zig corpus now has matching inst_len and all tags, but
  has 1 int_type data signedness mismatch (pre-existing issue).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 19:29:11 +00:00
parent 353959d28f
commit f8ccc6dca6
2 changed files with 5 additions and 3 deletions

View File

@@ -4374,7 +4374,7 @@ static uint32_t exprRl(GenZir* gz, Scope* scope, ResultLoc rl, uint32_t node) {
case AST_NODE_BLOCK_TWO_SEMICOLON: case AST_NODE_BLOCK_TWO_SEMICOLON:
case AST_NODE_BLOCK: case AST_NODE_BLOCK:
case AST_NODE_BLOCK_SEMICOLON: case AST_NODE_BLOCK_SEMICOLON:
return blockExprExpr(gz, scope, rl, node); return rvalue(gz, rl, blockExprExpr(gz, scope, rl, node), node);
// Anonymous array init (AstGen.zig:1119-1127). // Anonymous array init (AstGen.zig:1119-1127).
case AST_NODE_ARRAY_INIT_DOT_TWO: case AST_NODE_ARRAY_INIT_DOT_TWO:
case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA: case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA:
@@ -5611,6 +5611,8 @@ static uint32_t whileExpr(
// Evaluate condition in cond_scope (AstGen.zig:6571-6607). // Evaluate condition in cond_scope (AstGen.zig:6571-6607).
GenZir cond_scope = makeSubBlock(&loop_scope, &loop_scope.base); GenZir cond_scope = makeSubBlock(&loop_scope, &loop_scope.base);
// Emit debug node for the condition expression (AstGen.zig:6579).
emitDbgNode(&cond_scope, cond_node);
uint32_t cond = expr(&cond_scope, &cond_scope.base, cond_node); uint32_t cond = expr(&cond_scope, &cond_scope.base, cond_node);
// Create condbr + cond_block (AstGen.zig:6609-6615). // Create condbr + cond_block (AstGen.zig:6609-6615).

View File

@@ -798,8 +798,8 @@ test "astgen: corpus tokenizer_test.zig" {
} }
test "astgen: corpus parser_test.zig" { test "astgen: corpus parser_test.zig" {
// TODO: 1 inst diff — 1 STORE_NODE inside ptr-based struct init with // TODO: int_type signedness data mismatch at inst[6899] — all tags and
// block field init expression. // inst_len match, but one int_type has ref=signed got=unsigned.
if (true) return error.SkipZigTest; if (true) return error.SkipZigTest;
const gpa = std.testing.allocator; const gpa = std.testing.allocator;
try corpusCheck(gpa, @embedFile("parser_test.zig")); try corpusCheck(gpa, @embedFile("parser_test.zig"));