✓
Passing This code compiles and runs correctly.
Code
// PIN: a transform event living in a hyphenated module imported through an
// aliased path. The generated transform dispatch must reference the module
// struct by the EMITTER's spelling — `koru_` + raw name, escaped when the
// name needs it (`koru_lib.@"koru_my-module"`) — not by a kebab→underscore
// mangle (`koru_my_module`) the emitter never produces. The mismatch was a
// backend compile error naming a struct member that does not exist
// (found 2026-09-06 via the korulang.org sitevoice module).
const std = @import("std");
~import lib/my-module
~import std/io
~lib/my-module:transform-it()
Supporting Files
// The hyphenated module: `my-module`, imported as lib/my-module. A transform
// event here exercises the dispatch's module-reference spelling.
const std = @import("std");
~[comptime|transform|pre]pub tor transform-it {
invocation: *const Invocation,
item: *const Item,
} -> SiteResult
~[transform]proc transform-it|zig {
const ast_mod = @import("ast");
const flow = if (item.* == .flow)
&item.flow
else
return .{ .transformed = .{} };
for (flow.inv().annotations) |ann| {
if (std.mem.startsWith(u8, ann, "@pass_ran")) {
return .{ .transformed = .{} };
}
}
const inline_body_str =
\\//@koru:inline_stmt
\\ std.debug.print("hi\n", .{});
;
const new_inv_annotations = allocator.alloc([]const u8, flow.inv().annotations.len + 1) catch unreachable;
for (flow.inv().annotations, 0..) |ann, j| new_inv_annotations[j] = ann;
new_inv_annotations[flow.inv().annotations.len] = allocator.dupe(u8, "@pass_ran(\"transform\")") catch unreachable;
const new_invocation = ast_mod.Invocation{
.path = flow.inv().path,
.args = flow.inv().args,
.annotations = new_inv_annotations,
};
const empty_conts = allocator.alloc(ast_mod.Continuation, 0) catch unreachable;
var transformed_flow = flow.*;
transformed_flow.body = ast_mod.rootSite(new_invocation, empty_conts, flow.location);
transformed_flow.inline_body = inline_body_str;
return .{ .transformed = .{ .replacement = ast_mod.Item{ .flow = transformed_flow } } };
}
Actual
hi
Expected output
hi
Flows
flow ~transform-it click a branch to expand · @labels scroll to their anchor
transform-it
Test Configuration
MUST_RUN
koru.json:
{
"paths": {
"std": "../../../../../koru_std",
"lib": "./test_lib"
}
}