✓
Passing This code compiles and runs correctly.
Code
// Test 156b: Directory import with non-public events (negative test)
//
// Tests that importing events WITHOUT ~pub markers fails at compile time
// This enforces proper API boundaries
const std = @import("std");
// Import directory 'lib/raylib' containing graphics.kz and audio.kz
// Events in these files are NOT marked ~pub, so this should fail
~import app/lib/raylib
// Attempting to use non-public events should fail
~app/lib/raylib/graphics:render(width: 1920, height: 1080) |> app/lib/raylib/graphics:clear(color: 0xFF0000)
| cleared |> app/lib/raylib/audio:play(sound_id: 42) |> app/lib/raylib/audio:stop()
| stopped |> _
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected compiler error
error[KORU044]: cannot access private event 'app.lib.raylib.graphics:render' from module 'input'
--> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_008_dir_import_no_pub/input.kz:13:0
|
13 | ~app/lib/raylib/graphics:render(width: 1920, height: 1080) |> app/lib/raylib/graphics:clear(color: 0xFF0000)
| ^
hint: mark the event as public with ~pub event
error[KORU044]: cannot access private event 'app.lib.raylib.graphics:clear' from module 'input'
--> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_008_dir_import_no_pub/input.kz:16:0
|
16 |
| ^
hint: mark the event as public with ~pub event
error[KORU044]: cannot access private event 'app.lib.raylib.audio:play' from module 'input'
--> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_008_dir_import_no_pub/input.kz:14:4
|
14 | | cleared |> app/lib/raylib/audio:play(sound_id: 42) |> app/lib/raylib/audio:stop()
| ^
hint: mark the event as public with ~pub event
error[KORU044]: cannot access private event 'app.lib.raylib.audio:stop' from module 'input'
--> tests/regression/100_MODULE_SYSTEM/110_IMPORTS/110_008_dir_import_no_pub/input.kz:14:4
|
14 | | cleared |> app/lib/raylib/audio:play(sound_id: 42) |> app/lib/raylib/audio:stop()
| ^
hint: mark the event as public with ~pub event
Imported Files
// Audio module for raylib
const std = @import("std");
~event play { sound_id: i32 }
~event stop {}
~proc play|zig {
}
~proc stop|zig {
}
// Graphics module for raylib
const std = @import("std");
~event render { width: i32, height: i32 }
| drawn i32
~event clear { color: i32 }
~proc render|zig {
return .{ .@"drawn" = .{ .pixels = width * height } };
}
~proc clear|zig {
}