ffi issue-0050: monomorphizeFunction leaks pack-fn state — xfail lock-in
A generic fn (with `$T: Type` type params) called from inside a pack-fn mono inherits the outer pack maps during its OWN body lowering. Same root cause as issue-0048 — the lowering helper doesn't save/null `pack_arg_nodes` / `pack_param_count` / `pack_arg_types` — but on the generic-mono path (`monomorphizeFunction`, ~line 8718) rather than `lazyLowerFunction`. `examples/175-generic-fn-pack-state-leak.sx` calls `build(args: []Type, $ret: Type)` from a four-shape pack-fn. The expected output is `len=0 / 1 / 2 / 4`; today's run reports `len=0` for every shape because `build__void` was first monomorphised under `probe()`'s mono (N=0) and `args.len` got constant-folded to 0 inside the cached body. The next commit adds the same isolation pattern to `monomorphizeFunction`. Step 5 of the FFI plan (generic `Into(Block)` impl) needs the `build_block_convert(args: []Type, $ret: Type) -> string` builder, which trips this leak directly.
This commit is contained in:
1
tests/expected/175-generic-fn-pack-state-leak.exit
Normal file
1
tests/expected/175-generic-fn-pack-state-leak.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
6
tests/expected/175-generic-fn-pack-state-leak.txt
Normal file
6
tests/expected/175-generic-fn-pack-state-leak.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
0: len=0
|
||||
1: len=1
|
||||
2: len=2
|
||||
4: len=4
|
||||
--- build done ---
|
||||
rt
|
||||
Reference in New Issue
Block a user