✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
error[KORU030]: Phantom state mismatch: 'r' (parameter 'r') holds no live '<active!>' obligation to consume here — it was never acquired or has already been discharged. Pass a value that still holds its '<active!>' obligation.
--> tests/regression/200_COMPILER_FEATURES/220_COMPILATION/220_022_combined_continuation_bugs/input.kz:79:0
❌ Compiler coordination error: Phantom semantic validation failed
(set KORU_BACKEND_TRACE=1 for the backend return trace) Code
// PRIORITY: Combined test for all continuation codegen bugs
//
// This test exercises THREE bugs simultaneously:
// 1. Void event chaining (220_021) - switch on void
// 2. Nested branch shadowing (220_020) - |done| shadows |done|
// 3. Escape field name mismatch (330_052) - escape by name not value
//
// When all three are fixed, this test passes and Koru gets its signature syntax.
~import std/control
~import std/build
// Link libc for c_allocator
~std/build:requires { exe.linkLibC(); }
const std = @import("std");
const Resource = struct {
id: usize,
data: [64]u8,
};
const allocator = std.heap.c_allocator;
// ============================================================
// BUG #1: Void event chaining
// These are void events - no branches. Should chain with |>
// ============================================================
~tor work-void { r: *Resource }
~proc work-void|zig {
r.data[0] +%= 1;
}
// ============================================================
// BUG #2: Nested branch shadowing
// Same branch name "done" at multiple nesting levels
// ============================================================
~tor work-done { r: *Resource }
~proc work-done|zig {
r.data[0] +%= 1;
}
// ============================================================
// BUG #3: Escape field name mismatch
// Obligation escapes to differently-named field
// ============================================================
~tor create { id: usize } -> *Resource<active!>
~proc create|zig {
const r = allocator.create(Resource) catch unreachable;
r.* = Resource{ .id = id, .data = undefined };
return r;
}
~tor destroy { r: *Resource<!active> }
~proc destroy|zig {
allocator.destroy(r);
}
// Factory with DIFFERENT field name than create
~tor make-resource { id: usize } -> *Resource<active!> // "resource" not "r"
// BUG #3: f.r -> resource field name mismatch
~make-resource = create(id): f -> f
// ============================================================
// COMBINED TEST: Bugs #2 and #3 (void chaining is parser issue)
// ============================================================
const N: usize = 10;
~for(0..N)
! each i |> make-resource(id: i)
| ready r |> work-done(r) |> work-done(r) |> work-done(r) |> destroy(r)
pub fn main() void {
std.debug.print("All continuation bugs fixed!\n", .{});
}
Flows
flow ~requires click a branch to expand · @labels scroll to their anchor
requires (source: exe.linkLibC();)
subflow ~make-resource click a branch to expand · @labels scroll to their anchor
create (id)
flow ~for click a branch to expand · @labels scroll to their anchor
for (0..N)
Test Configuration
MUST_RUN