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.
This commit is contained in:
agra
2026-05-29 22:41:03 +03:00
parent 2836fe4d8d
commit 99baabd93f

View File

@@ -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