✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// VERIFIED REGRESSION TEST - DO NOT MODIFY WITHOUT DISCUSSION
// ============================================================================
// Test: Subflow with multiple chained continuations
// Feature: ~event = first(...) | b1 |> second(...) | b2 |> third(...) | b3 |> result
// Verifies: Subflows can chain multiple invocations through continuation pipelines
// ============================================================================
const std = @import("std");
~import std/io
// Helper event: triples a number
~event triple { value: i32 }
| tripled i32
~proc triple|zig {
return .{ .tripled = value * 3 };
}
// Helper event: doubles a number
~event double { value: i32 }
| doubled i32
~proc double|zig {
return .{ .doubled = value * 2 };
}
// Event to test
~event process { input: i32 }
| final i32
// Multi-continuation subflow: chains triple -> double -> final
~process = triple(value: input)
| tripled t |> double(value: t)
| doubled d => final d
// Helper to verify and print the result
~event verify-and-print { value: i32 }
~proc verify-and-print|zig {
if (value == 30) {
std.debug.print("30\n", .{});
} else {
std.debug.print("ERROR: Expected 30, got {}\n", .{value});
}
}
// Test: 5 * 3 * 2 = 30
~process(input: 5)
| final f |> verify-and-print(value: f)
Actual
30
Expected output
30
Test Configuration
MUST_RUN