✗
Failing This test is currently failing.
Failed: backend-exec
Error Details
Panic: comptime evaluation failed — see the diagnostic above
Failure Output
Showing last 10 of 35 lines
^
/Users/larsde/src/koru/tests/regression/000_CORE_LANGUAGE/030_LITERALS/030_016_array_literal_subflow_impl/backend.zig:240:51: 0x100698edf in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^
/opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:627:37: 0x1006a0cab in main (backend)
const result = root.main() catch |err| {
^
???:?:?: 0x18eec7dff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 387: 22588 Abort trap: 6 ./backend output Code
// TEST: Array literal in subflow implementation
//
// Array literals work in regular comptime flows but fail in subflow implementations
// using the `event = flow` syntax.
//
// This test mimics the compiler.kz coordinate pattern:
// [abstract] event coordinate { ... }
// coordinate = step1() | result r |> step2(values: [r.a, r.b, r.c])
const std = @import("std");
const Context = struct {
id: u32,
};
// Abstract event with multiple contexts
~[comptime|abstract] tor process { allocator: std.mem.Allocator } -> u32
// Step 1: Create contexts
~[comptime] tor setup {} -> { c0: Context, c1: Context, c2: Context }
~proc setup|zig {
return .{ .ready = .{
.c0 = .{ .id = 0 },
.c1 = .{ .id = 1 },
.c2 = .{ .id = 2 },
} };
}
// Step 2: Process array of contexts
~[comptime] tor consume { contexts: []const Context } -> u32
~proc consume|zig {
std.debug.print("[COMPTIME] Processing {} contexts\n", .{contexts.len});
return @intCast(contexts.len);
}
// THE KEY TEST: Subflow implementation with array literal
// This syntax (`process = ...`) creates a subflow_impl
// Array literals inside subflow_impl flows emit incorrectly
~process = setup(): r |> consume(contexts: [r.c0, r.c1, r.c2])
| consumed c -> c
// Trigger the flow
~process(allocator: std.heap.page_allocator): d |> report(count: d)
~[comptime] tor report { count: u32 }
~proc report|zig {
if (count == 3) {
std.debug.print("PASS: subflow array literal works\n", .{});
} else {
std.debug.print("FAIL: expected 3, got {}\n", .{count});
}
}
Flows
subflow ~process click a branch to expand · @labels scroll to their anchor
setup
flow ~process click a branch to expand · @labels scroll to their anchor
process (allocator: std.heap.page_allocator)
Test Configuration
MUST_RUN