Fixes follow-ups #3 (bare `args` reference) and #4 (`args[<runtime_int>]`) from step 2b. The pack-mono now materialises an `[]Any` slice value for the pack name at body entry: each pack-param slot is loaded, boxed via `boxAny`, and stored into a stack [N x Any] array; the slice {data_ptr, len} binds to the pack name in scope. Plumbing in src/ir/lower.zig: - `materialisePackSlice(scope, pack_name, slot_refs, arg_types)` — new helper that emits the array alloca + box+store loop + slice alloca + bind. Empty-pack case (N == 0) emits {null, 0} directly. - `monomorphizePackFn` captures the pack-param slot Refs as they bind, then calls `materialisePackSlice` after binding so the slice load can pull each param value. After: `args` (bare) resolves as `[]Any` and forwards to slice-typed helpers; `args[<runtime_int>]` lowers through the standard slice-indexing path, element type `Any`. Per-position type info is lost via Any boxing — that is the inherent cost of treating a heterogeneous pack as a uniform value. Literal- indexed access still routes through `packArgNodeAt` and keeps the concrete per-position types. `examples/162-pack-bare-args.sx` flips from "unresolved 'args'" to `3` (forwarded to `log_count(items: []Any)` which returns `items.len`). `examples/163-pack-runtime-index.sx` flips from the LLVM verifier crash to `4` (while-loop over `args.len`, indexing each `args[i]` runtime). 202/202 example tests + `zig build test` green.
2 lines
2 B
Plaintext
2 lines
2 B
Plaintext
0
|