std.zig.AstGen: properly handle grouped_expression

This fixes an endless loop in the compiler.
This commit is contained in:
Mateusz Poliwczak 2025-11-07 08:21:57 +01:00 committed by Matthew Lugg
parent ce355e0ba5
commit d942f693c5
2 changed files with 10 additions and 1 deletions

View file

@ -2607,7 +2607,7 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod
.assign_mul_wrap => try assignOp(gz, scope, statement, .mulwrap),
.grouped_expression => {
inner_node = tree.nodeData(statement).node_and_token[0];
inner_node = tree.nodeData(inner_node).node_and_token[0];
continue;
},

View file

@ -0,0 +1,9 @@
pub export fn entry() void {
((1 + 1)); // makes sure that the doubled grouped_expression does not cause an endless loop in AstGen.
}
// error
//
// :2:9: error: value of type 'comptime_int' ignored
// :2:9: note: all non-void values must be used
// :2:9: note: to discard the value, assign it to '_'