✓
Passing This code compiles and runs correctly.
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()
Error Verification
Expected Error Pattern
Keyword collision should cause compilation errorActual 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:97:17: 0x102585dcf in resolveKeyword (koruc)
return error.KeywordCollision;
^
/Users/larsde/src/koru/src/main.zig:4666:13: 0x1025859cb in resolveKeywordInPath (koruc)
return error.AmbiguousKeyword;
^
/Users/larsde/src/koru/src/main.zig:4458:13: 0x10258720b in resolveKeywordsInItem (koruc)
try resolveKeywordInPath(&flow.invocation.path, registry, allocator, main_module);
^
/Users/larsde/src/koru/src/main.zig:4441:9: 0x102587563 in resolveKeywordsInAST (koruc)
try resolveKeywordsInItem(item, registry, allocator, main_module, items);
^
/Users/larsde/src/koru/src/main.zig:6015:9: 0x10269cb13 in main (koruc)
try resolveKeywordsInAST(@constCast(source_file.items), &kw_registry, parse_allocator, source_file.main_module_name);
^Imported Files
// Library A defines [keyword] event process
~[keyword]pub event process {}
~proc process {
const std = @import("std");
std.debug.print("Process from lib_a\n", .{});
}
// Library B also defines [keyword] event process - creates collision!
~[keyword]pub event process {}
~proc process {
const std = @import("std");
std.debug.print("Process from lib_b\n", .{});
}
Test Configuration
MUST_FAIL
Expected Behavior:
FRONTEND_COMPILE_ERROR
Ambiguous keyword