fix: capture failable closures called via error-handling exprs

collectCaptures did not descend into catch/try/onfail/raise/multi_assign/
push/comptime/insert/spread/asm nodes, so a free variable referenced only
inside them (e.g. a failable worker called as `worker() catch {…}` in a
nested lambda) was never captured into the env struct — inside the lambda
it resolved against an empty scope and typed as 'unresolved'. Add the
missing traversal arms. The push_stmt arm also closes the noted
'free-var analysis does not descend into a nested push Context {…}' gap.

Unblocks the PLAN-IO-UNIFY Phase 3 async completion closure shape.
Lock: examples/closures/0314-closures-capture-failable-call.sx.
This commit is contained in:
agra
2026-06-28 09:18:15 +03:00
parent 213cedf0b5
commit 69a6ecfb57
5 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
ok 7
caught
try 105