✓
Passing This code compiles and runs correctly.
Code
// BUG: Subflow field shorthand { e } incorrectly emits `.{ .branch = e }` instead of `.{ .branch = .{ .e = e } }`
//
// SYNTAX DESIGN ISSUE:
// - Original: `{ e }` is shorthand for `{ e: e }` (field shorthand)
// - Later added: `branch { value }` to mean "branch with simple value"
// - These clash!
//
// PROPOSED FIX:
// - No braces = simple value: |> result 10
// - Braces = struct: |> entity { e } means { e: e }
//
// CURRENT BEHAVIOR:
// - `~foo = bar { e }` emits: return .{ .bar = e };
// - SHOULD emit: return .{ .bar = .{ .e = e } };
//
// WORKAROUND: Use explicit `{ e: e }` syntax
~import std/io
~import std/control
const std = @import("std");
const Entity = struct {
id: u32,
};
~pub event test-event { e: Entity } -> Entity
// Identity branch syntax - result IS the Entity
~test-event -> e
~event print-result { e: Entity }
~proc print-result|zig {
std.debug.print("Got entity {d}\n", .{ e.id });
}
const entity = Entity{ .id = 42 };
~test-event(e: entity): r |> print-result(e: r)
Actual
Got entity 42
Expected output
Got entity 42
Flows
flow ~test-event click a branch to expand · @labels scroll to their anchor
test-event (e: entity)
Test Configuration
MUST_RUN