✓
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()
Frontend must reject with:
Ambiguous keywordError 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: 0x100eaae2b in resolveKeyword (koruc)
return error.KeywordCollision;
^
/Users/larsde/src/koru/src/main.zig:5267:13: 0x100eaa82b in resolveKeywordInPath (koruc)
return error.AmbiguousKeyword;
^
/Users/larsde/src/koru/src/main.zig:5037:13: 0x100eac2cf in resolveKeywordsInItem (koruc)
try resolveKeywordInPath(&flow.invMut().path, registry, allocator, main_module, all_items);
^
/Users/larsde/src/koru/src/main.zig:5020:9: 0x100eac6e7 in resolveKeywordsInAST (koruc)
try resolveKeywordsInItem(item, registry, allocator, main_module, items);
^
/Users/larsde/src/koru/src/main.zig:6778:9: 0x100ff1f1b 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|zig {
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|zig {
const std = @import("std");
std.debug.print("Process from lib_b\n", .{});
}
Test Configuration
MUST_FAIL