Pack-fn bodies that index the pack via `args[<int_literal>]` now resolve to the i-th call-site argument's lowered value directly, propagating the call arg's concrete type instead of the boxed `Any` that the `[]Any` slice path returns. New plumbing in `src/ir/lower.zig`: - `pack_arg_nodes: ?std.StringHashMap([]const *const Node)` on Lowering. Maps a pack param name (e.g. "args") to the slice of call-site arg AST nodes. - `lowerComptimeCall` populates the map when the variadic param is heterogeneous (`is_variadic AND is_comptime`, i.e. the `..$args` form). Plain `args: ..Any` keeps the existing `[]Any` slice path so stdlib's `format`/`print` continue unchanged. The map is saved/restored across nested calls mirroring `comptime_param_nodes`. - `packArgNodeAt(ie)` returns the call-arg node when an index_expr matches `<pack_name>[<comptime_int_literal>]` with the index in range; null otherwise (fall through to standard slice indexing for runtime indices or non-pack bases). - `lowerIndexExpr` checks `packArgNodeAt` first; on a hit it lowers the call arg node directly. `inferExprType`'s `index_expr` arm does the parallel check so AST-level type inference (e.g., for field-access type checking) sees the concrete call-arg type. `examples/156-pack-typed-index.sx` flips from "field 'x' not found on type 'Any'" to `7` — `args[0].x` now resolves through the concrete `Point` type instead of Any. Out of scope (deferred): non-literal comptime indices (`args[$i]` where `$i` is an arbitrary comptime expression); `$args[$i]` in type positions (step 3); per-mono mangling (monomorphisation stays inline-only). 195/195 example tests + `zig build test` green.
2 lines
2 B
Plaintext
2 lines
2 B
Plaintext
0
|