✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
error[KORU030]: Phantom state mismatch: argument 'conn' has no tracked phantom state, but event requires one of '<active|paused>'.
--> phantom_semantic_check:3:0
error[KORU030]: Phantom state mismatch: argument 'conn' has no tracked phantom state, but event requires one of '<active|paused>'.
--> phantom_semantic_check:5:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
???:?:?: 0x10239f9d3 in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x1023a0b63 in _backend.main (???) Code
~import app/connection
~app/connection:create(): c1 |> app/connection:connect(conn: c1): c2 |> app/connection:resume(conn: c2) // active -> resume accepts it!
| resumed c3 |> app/connection:close(conn: c3)
~app/connection:create(): c1 |> app/connection:connect(conn: c1): c2 |> app/connection:pause(conn: c2): c3 |> app/connection:resume(conn: c3) // paused -> resume accepts it!
| resumed c4 |> app/connection:close(conn: c4)
~app/connection:create(): c1 |> app/connection:connect(conn: c1): c2 |> app/connection:close(conn: c2) // active -> close accepts it!
~app/connection:create(): c1 |> app/connection:connect(conn: c1): c2 |> app/connection:pause(conn: c2): c3 |> app/connection:close(conn: c3) // paused -> close accepts it!
Expected output
Creating connection
Connecting: 1
Resuming/continuing: 1
Closing: 1
Creating connection
Connecting: 1
Pausing: 1
Resuming/continuing: 1
Closing: 1
Creating connection
Connecting: 1
Closing: 1
Creating connection
Connecting: 1
Pausing: 1
Closing: 1
Flows
flow ~create click a branch to expand · @labels scroll to their anchor
create
flow ~create click a branch to expand · @labels scroll to their anchor
create
flow ~create click a branch to expand · @labels scroll to their anchor
create
flow ~create click a branch to expand · @labels scroll to their anchor
create
Imported Files
// Library module: connection
// Demonstrates phantom state unions - events that accept multiple states
const std = @import("std");
// Connection type with phantom states
const Connection = struct {
id: i32,
};
// Create a new connection - starts in 'idle' state
~pub event create {} -> *Connection<idle>
~proc create|zig {
std.debug.print("Creating connection\n", .{});
const allocator = std.heap.page_allocator;
const c = allocator.create(Connection) catch unreachable;
c.* = Connection{ .id = 1 };
return c;
}
// Connect - transitions from idle to active
~pub event connect { conn: *Connection<idle> } -> *Connection<active>
~proc connect|zig {
std.debug.print("Connecting: {d}\n", .{conn.id});
return conn;
}
// Pause - transitions from active to paused
~pub event pause { conn: *Connection<active> } -> *Connection<paused>
~proc pause|zig {
std.debug.print("Pausing: {d}\n", .{conn.id});
return conn;
}
// Resume - accepts EITHER paused OR active (union!) - always returns active
// This demonstrates the core union feature: flexible input acceptance
~pub event resume { conn: *Connection<paused|active> } -> *Connection<active>
~proc resume|zig {
std.debug.print("Resuming/continuing: {d}\n", .{conn.id});
return conn;
}
// Close - accepts active OR paused (union!) - cleans up connection
~pub event close { conn: *Connection<active|paused> }
~proc close|zig {
std.debug.print("Closing: {d}\n", .{conn.id});
}
Test Configuration
MUST_RUN