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 11584731 panic: comptime evaluation failed — see the diagnostic above
/Users/larsde/src/koru/src/comptime_eval.zig:180:9: 0x102a31d8b in fail__anon_120741 (backend)
        return err;
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:424:17: 0x102918bb3 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: 0x102a32007 in walkLabeledBody (backend)
        var head_args: []const ArgValue = try self.evalArgs(env, inv.args);
                                          ^
/Users/larsde/src/koru/src/comptime_eval.zig:464:9: 0x102918e9f in walkFlow (backend)
        return self.walkLabeledBody(items, &flow.body, flow.pre_label, &env);
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:793:24: 0x1027318e3 in walkFlowResidue (backend)
        const result = try self.evaluator.walkFlow(program.items, sub, args);
                       ^
/Users/larsde/src/koru/src/comptime_eval.zig:749:48: 0x10253648b 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:1369:25: 0x10250f0b3 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:1405:85: 0x10250adf7 in handler (backend)
                const __thread7 = koru_std.koru_compiler.fold_comptime_event.handler(.{ .ctx = __thread6 });
                                                                                    ^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_137_comptime_walk_source_arg_refuses/backend_output_emitted.zig:1245:74: 0x10250a357 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:12045:67: 0x10250a1a3 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: 0x10249a603 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:620:32: 0x10249b937 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: 0x10249da5b in main (backend)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x18073fdff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 559: 90663 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