✓
Passing Passing: the compiler rejects this program as expected.
Code
// Test: Keyword collision - two modules define same keyword
// This should produce an error at process() usage
import lib_a
import lib_b
// Using process without qualification - should error because both lib_a and lib_b define it
process()
Supporting Files
// Library A defines [keyword] event process
~[keyword]pub tor process {}
~proc process|zig {
const std = @import("std");
std.debug.print("Process from lib_a\n", .{});
}
// Library B also defines [keyword] event process - creates collision!
~[keyword]pub tor process {}
~proc process|zig {
const std = @import("std");
std.debug.print("Process from lib_b\n", .{});
}
Actual compiler output
ERROR: Ambiguous keyword 'process' - defined in:
- lib_a:process (from lib_a)
- lib_b:process (from lib_b)
error: AmbiguousKeyword
/Users/larsde/src/koru/src/keyword_registry.zig:100:17: 0x1044412d7 in resolveKeyword (koruc)
return error.KeywordCollision;
^
/Users/larsde/src/koru/src/keyword_registry.zig:389:13: 0x104440cd7 in resolveInPath (koruc)
return error.AmbiguousKeyword;
^
/Users/larsde/src/koru/src/keyword_registry.zig:202:13: 0x1044428af in resolveInItem (koruc)
try resolveInPath(&flow.invMut().path, registry, allocator, home_module, home_items);
^
/Users/larsde/src/koru/src/keyword_registry.zig:188:9: 0x104442c5f in resolveInASTWithLookup (koruc)
try resolveInItem(item, registry, allocator, home_module, home_items, all_items);
^
/Users/larsde/src/koru/src/keyword_registry.zig:173:5: 0x104442cf7 in resolveInAST (koruc)
try resolveInASTWithLookup(items, registry, allocator, home_module, items, items);
^
/Users/larsde/src/koru/src/main.zig:7037:9: 0x1045e6c23 in main (koruc)
try keyword_registry.resolveInAST(@constCast(source_file.items), &kw_registry, parse_allocator, source_file.main_module_name);
^Frontend must reject with:
Ambiguous keywordExpected patterns
Each line is a regex that must match the compiler error output.
# Test 330_002: Ambiguous keyword collision must produce a user-facing diagnostic
# naming the keyword and both defining modules, plus pin the call chain.
# Hex addresses and exact line numbers in src/*.zig shift with every build.
^ERROR: Ambiguous keyword 'process' - defined in:$
^ - lib_a:process \(from lib_a\)$
^ - lib_b:process \(from lib_b\)$
^error: AmbiguousKeyword$
keyword_registry\.zig:[0-9]+:[0-9]+: 0x[0-9a-f]+ in resolveKeyword \(koruc\)
keyword_registry\.zig:[0-9]+:[0-9]+: 0x[0-9a-f]+ in resolveInPath \(koruc\)
keyword_registry\.zig:[0-9]+:[0-9]+: 0x[0-9a-f]+ in resolveInAST \(koruc\)
main\.zig:[0-9]+:[0-9]+: 0x[0-9a-f]+ in main \(koruc\)Flows
flow ~process click a branch to expand · @labels scroll to their anchor
process
Test Configuration
MUST_ERROR
koru.json:
{
"paths": {
"std": "../../../../../koru_std",
"lib_a": "./lib_a.kz",
"lib_b": "./lib_b.kz"
}
}