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 440235992 panic: comptime evaluation failed — see the diagnostic above
/Users/larsde/src/koru/src/comptime_eval.zig:180:9: 0x1026b2a23 in fail__anon_117702 (backend)
        return err;
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:424:17: 0x102604d8f 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: 0x1026b2c9f in walkLabeledBody (backend)
        var head_args: []const ArgValue = try self.evalArgs(env, inv.args);
                                          ^
/Users/larsde/src/koru/src/comptime_eval.zig:464:9: 0x10260507b in walkFlow (backend)
        return self.walkLabeledBody(items, &flow.body, flow.pre_label, &env);
        ^
/Users/larsde/src/koru/src/comptime_eval.zig:793:24: 0x1024b6ccf in walkFlowResidue (backend)
        const result = try self.evaluator.walkFlow(program.items, sub, args);
                       ^
/Users/larsde/src/koru/src/comptime_eval.zig:749:48: 0x10225766b 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:1201:25: 0x10223070b 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:1233:85: 0x10222c963 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:1025:74: 0x10222bf33 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:11007:67: 0x10222bd7f 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: 0x1021a93fb 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:324:51: 0x1021aaef7 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: 0x1021b6207 in main (backend)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x1816a3dff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 494:  6170 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