test(ir): lock error-flow diagnostics before A5.2 extraction (A5.2 scaffolding step 1)

Test-first scaffolding for the path-sensitive error-flow pass
(checkErrorFlow/analyzeFnBody/flowWalk/flowIf/checkCleanupBody) before it
moves into src/ir/error_flow.zig. No compiler change — both examples lock
current behavior.

- 1051-errors-cleanup-closure-boundary (accepted): a closure literal inside a
  `defer` body is its own function boundary — the E1.7 cleanup rule and the
  parser's try/raise ban both stop at the lambda, and E1.8 value-slot liveness
  runs per-boundary. Pins checkCleanupNode's `.lambda` stop + flowExpr's
  `.lambda` recursion. Constructible since issue 0073 (0310).
- 1052-errors-cleanup-transitive-reject (exit 1): the E1.7 cleanup check is
  transitive — bare failables nested in an `if` (both branches), a nested
  block, and a `while` body all reject. Pins checkCleanupNode's recursive arms,
  distinct from 1049's direct-body case.

No .test.zig/.ir: diagnostic-pass altitude (checkErrorFlow/A2.4 precedent) —
the pass returns no fact object and emits no IR.

Gate: zig build, zig build test, run_examples.sh -> 360/0.
This commit is contained in:
agra
2026-06-03 06:31:18 +03:00
parent 08f263c6e4
commit 95895a3bb2
8 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
body
defer closure: v=21
defer closure: raised

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,17 @@
error: a bare failable call in a `defer` body has nowhere to send its error — the block is already exiting; absorb it locally with `catch` or `or <value>`
--> examples/1052-errors-cleanup-transitive-reject.sx:19:13
|
19 | failing(); // REJECTED: nested in the `if` then-branch
| ^^^^^^^^^
error: a bare failable call in a `defer` body has nowhere to send its error — the block is already exiting; absorb it locally with `catch` or `or <value>`
--> examples/1052-errors-cleanup-transitive-reject.sx:21:15
|
21 | { failing(); } // REJECTED: nested block in the else-branch
| ^^^^^^^^^
error: a bare failable call in a `onfail` body has nowhere to send its error — the block is already exiting; absorb it locally with `catch` or `or <value>`
--> examples/1052-errors-cleanup-transitive-reject.sx:26:13
|
26 | failing(); // REJECTED: nested in the `while` body
| ^^^^^^^^^