From 99baabd93f8fb58058c61b05a0df7e01290fd4be Mon Sep 17 00:00:00 2001 From: agra Date: Fri, 29 May 2026 22:41:03 +0300 Subject: [PATCH] ir: resolveTypeWithBindings pack-index errors return .unresolved, not .s64 The OOB-index and missing-binding cases already emit a real user-facing diagnostic, but returned a plausible .s64 -- which would silently fabricate an 8-byte int if compilation continued past the error. Return the .unresolved sentinel instead (trips the sizeOf/toLLVMType panic at codegen). Diagnostic text unchanged, so snapshots are unaffected. --- src/ir/lower.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ir/lower.zig b/src/ir/lower.zig index 671cd76..b1e8d6a 100644 --- a/src/ir/lower.zig +++ b/src/ir/lower.zig @@ -10793,8 +10793,9 @@ pub const Lowering = struct { // i-th element type of the active pack binding (step 3 of the // variadic heterogeneous type packs feature). Unblocks parametric // trampoline bodies (`(*void, $args[0]) -> $args[1]`) in stdlib's - // generic Into(Block) impl. OOB indices emit a diagnostic; no - // binding → bail with a diagnostic-friendly placeholder. + // generic Into(Block) impl. OOB indices / a missing binding emit a + // diagnostic and return the `.unresolved` sentinel — never a plausible + // `.s64`, which would silently fabricate an 8-byte int. if (node.data == .pack_index_type_expr) { const pi = node.data.pack_index_type_expr; if (self.pack_arg_types) |pat| { @@ -10806,7 +10807,7 @@ pub const Lowering = struct { if (arg_tys.len == 1) @as([]const u8, "") else @as([]const u8, "s"), }); } - return .s64; + return .unresolved; } } if (self.diagnostics) |diags| { @@ -10814,7 +10815,7 @@ pub const Lowering = struct { pi.pack_name, pi.index, }); } - return .s64; + return .unresolved; } // `*Self` substitution inside foreign-class member declarations // — both foreign and sx-defined — resolves to the class's own