✓
Passing This code compiles and runs correctly.
Code
// PINS: an obligation held at a subflow's EXIT gets its close AUTO-INSERTED
// before the subflow returns — `check-file` ends still holding <opened!>
// from `app/fs:open`, and the produced program must print the close.
//
// HISTORY: written 2026-07-24 as a branch-constructor arm
// (`| opened _ -> "file exists"`); KORU021 (landed 2026-08-18) refuses
// named arms on bare-returning tors, so the pin could not run.
// Re-spelled 2026-08-25 onto bare-return grammar grounded on 310_006
// (bind-and-pipe off a bare return) and 330_074 (flow-defined tor whose
// params are visible in the body). The discharge-before-return claim is
// measured TRUE on this spelling: both lines print, close auto-inserted.
~import app/fs
~tor check-file { path: string } -> string
~check-file = app/fs:open(path): f |> say-exists()
~tor say-exists {} -> string
~proc say-exists|zig {
return "file exists";
}
~check-file(path: "test.txt")
Supporting Files
const std = @import("std");
const File = struct { handle: i32 };
~pub tor open { path: string } -> *File<opened!>
~proc open|zig {
std.debug.print("Opening file: {s}\n", .{path});
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return f;
}
~pub tor close { file: *File<!opened> }
~proc close|zig {
std.debug.print("Closing file (auto-discharged)\n", .{});
}
Actual
Opening file: test.txt
Closing file (auto-discharged)
Expected output
Opening file: test.txt
Closing file (auto-discharged)
Flows
subflow ~check-file click a branch to expand · @labels scroll to their anchor
open (path)
flow ~check-file click a branch to expand · @labels scroll to their anchor
check-file (path: "test.txt")
Test Configuration
MUST_RUN