zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d0ba6642b5407a904ff0bec5b8f05ab65652f428 (tree)
parent 14ba3bd9a1ac921bec6be01b0940856097406e41
Author: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Date:   Tue, 18 Nov 2025 16:06:49 +0100

std.Zig.AstGen: handle properly .inferred_ptr and .destructure in enum_literal handling

rl.resultType() returns null for inferred_ptr and destructure, so move
that to the unreachable block.

Diffstat:
Mlib/std/zig/AstGen.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig @@ -1006,9 +1006,9 @@ fn expr(gz: *GenZir, scope: *Scope, ri: ResultInfo, node: Ast.Node.Index) InnerE .field_name_start = str_index, }); switch (ri.rl) { - .discard, .none, .ref => unreachable, // no result type + .discard, .none, .ref, .inferred_ptr, .destructure => unreachable, // no result type .ty, .coerced_ty => return res, // `decl_literal` does the coercion for us - .ref_coerced_ty, .ptr, .inferred_ptr, .destructure => return rvalue(gz, ri, res, node), + .ref_coerced_ty, .ptr => return rvalue(gz, ri, res, node), } } else return simpleStrTok(gz, ri, tree.nodeMainToken(node), node, .enum_literal), .error_value => return simpleStrTok(gz, ri, tree.nodeMainToken(node) + 2, node, .error_value),