obligation lost at boundary

✓ Passing This code compiles and runs correctly.

Code

// Test 518: Obligation lost at boundary
// Tests that obligations cannot disappear at flow boundaries
//
// Key points:
// - bad_subflow internally opens a file (*File[opened!])
// - bad_subflow returns 'done {}' with NO [!] in signature
// - This loses track of the obligation
// - ERROR: Obligation must either be cleaned OR returned with [!]

~import "$app/bad_subflow"

~app.bad_subflow:bad_subflow()
| done |> _
input.kz

Imported Files

~import "$app/fs"

// BAD: Opens file but doesn't document obligation in signature
~pub event bad_subflow {}
| done {}  // NO [!] in signature - obligation disappears!

~proc bad_subflow {
    ~app.fs:open(path: "data.txt")
    | opened f |> done {}
    // ERROR: f.file has [opened!] obligation
    // but 'done' branch has no [!] in signature
    // Obligation is lost!
}
bad_subflow.kz
const std = @import("std");
const File = struct { handle: i32 };

~pub event open { path: []const u8 }
| opened { file: *File[opened!] }

~proc open {
    std.debug.print("Opening file: {s}\n", .{path});
    const allocator = std.heap.page_allocator;
    const f = allocator.create(File) catch unreachable;
    f.* = File{ .handle = 42 };
    return .{ .opened = .{ .file = f } };
}
fs.kz

Test Configuration

MUST_FAIL