✗
Failing This test is currently failing.
Failed: backend-exec
Error Details
output_emitted.zig:164:11: error: unreachable code
Failure Output
🎯 Compiler coordination: Passes: 20 (flow-based: elaborate, analysis, emission)
Error: output_emitted.zig:164:11: error: unreachable code
_ = &result_1;
~~^~~~~~~~~~~
output_emitted.zig:163:9: note: control flow is diverted here
return h0;
^~~~~~~~~
output_emitted.zig:164:14: error: use of undeclared identifier 'result_1'
_ = &result_1;
^~~~~~~~ Code
// PINS (held-across): an obligation OWNED in the same scope as a label-fold is
// NOT the loop's to consume — the fold runs over a SCALAR (never touches the
// handle), and the handle is escaped on the exit branch's bare return. h0 is
// live (uncleaned) at `@loop(c: c2)` but is held across and escaped on `fin`;
// the escape `-> h0` re-issues it through spin's `-> *Handle<owned!>` return,
// so the caller's dispose is the one discharge. No disposal belongs inside the
// fold's exit arm.
//
// Spelled with branch arms per 510_109's ruling (an inline `: v` on a branching
// tor is KORU022); the carry shape mirrors green 330_074.
const std = @import("std");
const Handle = struct { n: i32 };
~tor make {} -> *Handle<owned!>
~proc make|zig {
const h = std.heap.page_allocator.create(Handle) catch unreachable;
h.* = .{ .n = 0 };
return h;
}
~tor icount { c: i32 }
| more i32
| fin i32
~proc icount|zig {
if (c < 3) return .{ .more = c + 1 };
return .{ .fin = c };
}
~tor dispose { h: *Handle<!owned> }
~proc dispose|zig {
std.debug.print("n={}\n", .{h.n});
std.heap.page_allocator.destroy(h);
}
~tor spin {} -> *Handle<owned!>
~spin = make(): h0 |> #loop icount(c: 0)
| more c2 |> @loop(c: c2)
| fin _ -> h0
~spin(): hf |> dispose(h: hf)
Expected output
n=0
Flows
subflow ~spin click a branch to expand · @labels scroll to their anchor
make
flow ~spin click a branch to expand · @labels scroll to their anchor
spin
Test Configuration
MUST_RUN