Files
sx/tests
agra 159f898ffe ffi M5.A.next.2b.fu1.B: mixed comptime+pack — mono with comptime values folded into mangle
Fixes follow-up #1 from step 2b. Pack-fns can now mix non-pack
comptime params with the trailing pack:

  tagged :: ($tag: s32, ..$args) -> s64 {
      return tag * 100 + args.len;
  }

`isPackFn` relaxed to "exactly one trailing pack + any number
of non-pack comptime params". The mono path takes over.

Plumbing in src/ir/lower.zig:

- `lowerPackFnCall` walks fd.params + call_node.args in lockstep:
  comptime non-pack args fold into the mangle (`__ct_<value>`
  segments); non-comptime non-pack args contribute to the
  runtime arg-type list; remaining call args populate the pack
  expansion.
- `appendComptimeValueMangle` mangles int / bool / float /
  string literals stably. Strings hash to keep the symbol short.
  Distinct comptime values get distinct monos.
- `monomorphizePackFn` takes `call_node` so it can read comptime
  call args. Skips comptime non-pack params when building the
  runtime IR signature. Binds each comptime non-pack param both
  as a `comptime_param_nodes` entry (for `#insert`) AND as a
  runtime local via alloca+store (for bare-name body access).

`examples/164-pack-mixed-comptime.sx` flips from "unresolved
'tag'" to `703` / `900`. Two calls of `tagged` with
different comptime tags get distinct monos
(`tagged__ct_7__pack_...` and `tagged__ct_9__pack`).

This is the load-bearing prerequisite for step 6 of the plan
(stdlib `print` / `format` refactor to `(\$fmt, ..\$args)`).

Out of scope:
- Non-literal comptime args. `appendComptimeValueMangle`
  degrades them to `?` (so two distinct non-literal expressions
  in the same call slot would collide). Acceptable since
  literal args are the only common case; non-literal would need
  comptime evaluation to determine the value.

203/203 example tests + `zig build test` green.
2026-05-27 16:47:52 +03:00
..
05
2026-02-26 14:46:21 +02:00
2026-02-18 15:59:49 +02:00