137 comptime walk source arg refuses

✓ Passing Passing: the compiler rejects this program as expected.

Code

input.k

Actual compiler output

comptime fold failed: comptime walk: argument `source` is a Source capture — Source params belong to transforms, which run at elaboration, not to walkable calls
thread 144380396 panic: comptime evaluation failed — see the diagnostic above
/Users/larsde/src/koru/src/comptime_eval.zig:180:9: 0x1047a9223 in fail__anon_114820 (backend)
        return err;
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:424:17: 0x1046b2503 in evalArgs (backend)
                return self.fail(error.UnsupportedConstruct, "comptime walk: argument `{s}` is a Source capture — Source params belong to transforms, which run at elaboration, not to walkable calls", .{arg.name});
                ^
/Users/larsde/src/koru/src/comptime_eval.zig:490:43: 0x1047a949f in walkLabeledBody (backend)
        var head_args: []const ArgValue = try self.evalArgs(env, inv.args);
                                          ^
/Users/larsde/src/koru/src/comptime_eval.zig:464:9: 0x1046b27ef in walkFlow (backend)
        return self.walkLabeledBody(items, &flow.body, flow.pre_label, &env);
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:793:24: 0x1044d5fab in walkFlowResidue (backend)
        const result = try self.evaluator.walkFlow(program.items, sub, args);
                       ^
/Users/larsde/src/koru/src/comptime_eval.zig:749:48: 0x1042eb3af in fold (backend)
                                .walk => |sub| try self.walkFlowResidue(program, cur, sub),
                                               ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend_output_emitted.zig:1319:25: 0x1042c423b in handler (backend)
                        @panic("comptime evaluation failed — see the diagnostic above");
                        ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend_output_emitted.zig:1351:85: 0x1042c0197 in handler (backend)
                const __thread5 = koru_std.koru_compiler.fold_comptime_event.handler(.{ .ctx = __thread4 });
                                                                                    ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend_output_emitted.zig:1195:74: 0x1042bf767 in handler (backend)
                const c1 = koru_std.koru_compiler.elaborate_event.handler(.{ .ctx = c0 });
                                                                         ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend_output_emitted.zig:11931:67: 0x1042bf5b3 in koru_coordinate (backend)
    const result = koru_std.koru_compiler.coordinate_event.handler(.{
                                                                  ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend.zig:93:39: 0x1042513fb in emit (backend)
        const result = koru_coordinate(source_ast, &allocator);
                                      ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend.zig:586:32: 0x104252717 in main (backend)
    _ = try RuntimeEmitter.emit(compile_allocator, final_ast);
                               ^
/opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:627:37: 0x104254307 in main (backend)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x18b493dff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 559:  5392 Abort trap: 6           ./backend output

Error output must contain

is a Source capture — Source params belong to transforms, which run at elaboration, not to walkable calls

Flows

subflow ~get-input click a branch to expand · @labels scroll to their anchor
capture (source: v: 40[i64])
flow ~get-input click a branch to expand · @labels scroll to their anchor
get-input

Test Configuration

MUST_ERROR