ir: resolveAstType pack-index arm returns .unresolved, not .s64

The pack-aware caller (resolveTypeWithBindings) resolves pack-index type
exprs against the active binding before delegating, so reaching this bare
type_bridge path means the binding was missing. .s64 silently fabricated
an 8-byte int; return the .unresolved sentinel so it surfaces (trips the
sizeOf/toLLVMType panic at codegen). Closes the last .s64 escape in
resolveAstType.
This commit is contained in:
agra
2026-05-29 22:35:32 +03:00
parent b91b7f882c
commit 2836fe4d8d

View File

@@ -34,11 +34,14 @@ pub fn resolveAstType(node: ?*const Node, table: *TypeTable) TypeId {
.pack_index_type_expr => {
// Pack-index `$args[N]` in a type position must be resolved
// against an active pack binding — `type_bridge` has no access
// to that state, so this bare path falls back to .s64 with a
// diagnostic logged. The pack-aware caller (lowering's
// `resolveTypeWithBindings`) handles this case directly.
std.debug.print("type_bridge: pack-index type expression encountered outside a pack-aware context\n", .{});
return .s64;
// to that state. The pack-aware caller (lowering's
// `resolveTypeWithBindings`) handles this case directly *before*
// delegating here, so reaching this bare path means the binding
// was missing. `.s64` would silently fabricate an 8-byte int;
// return `.unresolved` so it surfaces (trips the sizeOf/toLLVMType
// panic at codegen).
std.debug.print("type_bridge: pack-index type expression encountered outside a pack-aware context — returning .unresolved\n", .{});
return .unresolved;
},
.tuple_literal => |tl| resolveTupleLiteralAsType(&tl, table),
.parameterized_type_expr => |pt| resolveParameterizedType(&pt, table),