zig

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

commit 73498737a2da4f43002783da4755a67aba42344e (tree)
parent 06eebafadd471ee287bfd4436b0c3ffcae3136c8
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Wed,  9 Apr 2025 23:23:44 -0400

x86_64: fix `error_set_has_value` of inferred error sets

Diffstat:
Msrc/arch/x86_64/CodeGen.zig | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig @@ -116306,10 +116306,17 @@ const Select = struct { }, .frame => |frame_index| .{ try cg.tempInit(spec.type, .{ .load_frame = .{ .index = frame_index } }), true }, .lazy_symbol => |lazy_symbol_spec| { + const ip = &pt.zcu.intern_pool; const ty = if (lazy_symbol_spec.ref == .none) spec.type else lazy_symbol_spec.ref.typeOf(s); const lazy_symbol: link.File.LazySymbol = .{ .kind = lazy_symbol_spec.kind, - .ty = ty.toIntern(), + .ty = switch (ip.indexToKey(ty.toIntern())) { + .inferred_error_set_type => |func_index| switch (ip.funcIesResolvedUnordered(func_index)) { + .none => unreachable, // unresolved inferred error set + else => |ty_index| ty_index, + }, + else => ty.toIntern(), + }, }; return .{ try cg.tempInit(.usize, .{ .lea_symbol = .{ .sym_index = if (cg.bin_file.cast(.elf)) |elf_file|