From 2836fe4d8dfe0d13603c3ad78561fbc6b2fe6667 Mon Sep 17 00:00:00 2001 From: agra Date: Fri, 29 May 2026 22:35:32 +0300 Subject: [PATCH] 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. --- src/ir/type_bridge.zig | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ir/type_bridge.zig b/src/ir/type_bridge.zig index d497951..dfbea28 100644 --- a/src/ir/type_bridge.zig +++ b/src/ir/type_bridge.zig @@ -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),