refactor(ir): pack projections → PackResolver + retire the alias borrow (A2.3)
A2-merge gate: both parts in one commit, behavior-preserving (350/0). Part 1 — retire the TypeTable.aliases borrow (build-enforced): - type_bridge.zig: add `AliasMap` and thread it as an explicit param through every name-resolving fn (resolveAstType, bridgeType, resolveTypeName, the compound resolvers, resolveTupleLiteralAsType, resolveParameterizedType, the inline enum/struct/union + error resolvers). resolveTypeName now forwards the threaded map to TypeResolver.resolveNamed instead of reading table.aliases. - lower.zig: all 31 resolveAstType callers pass &self.program_index.type_alias_map; drop the lowerRoot loan. - types.zig: remove the now-unused TypeTable.aliases field. - type_bridge.test.zig: alias test passes alias_map explicitly; other calls pass null. Part 2 — pack projections get one owner + no .void failure sentinel: - New packs.zig (PackResolver, a *Lowering facade): moves resolveClosure/Tuple/FunctionTypeWithBindings, packTypeElems, packTypeArgs, elementProtocolTypeArg out of Lowering. Call sites route through Lowering.packResolver(); barrel-wired in ir.zig. - The missing-projection `orelse .void` in packTypeArgs now emits a diagnostic and fills the slot with .unresolved (the tripwire sentinel), never a real .void; OOM `catch return .void` in the moved fns became .unresolved too. Legitimate no-return-type `else .void` defaults are preserved. - packs.test.zig: packTypeArgs bound/unbound/no-constraint/no-state cases + the missing-projection backstop (diagnostic + .unresolved slot).
This commit is contained in:
@@ -332,14 +332,6 @@ pub const TypeTable = struct {
|
||||
slice_arena: std.heap.ArenaAllocator,
|
||||
/// Target pointer size in bytes (4 for wasm32, 8 for 64-bit targets).
|
||||
pointer_size: u8 = 8,
|
||||
/// Borrowed pointer to `Lowering.program_index.type_alias_map`. When set,
|
||||
/// `resolveTypeName` consults it before falling through to
|
||||
/// the empty-struct-stub default — so a name like `ShaderHandle`
|
||||
/// (defined `ShaderHandle :: u32`) resolves to `u32` rather than
|
||||
/// being interned as a fresh empty struct. Pointer lifetime is
|
||||
/// the owning Lowering's; consumers must clear it before the
|
||||
/// Lowering is torn down.
|
||||
aliases: ?*const std.StringHashMap(TypeId) = null,
|
||||
|
||||
pub fn init(alloc: Allocator) TypeTable {
|
||||
var table = TypeTable{
|
||||
|
||||
Reference in New Issue
Block a user