✓
Passing This code compiles and runs correctly.
Code
// Test 110_002: Directory Import WITHOUT Public Markers
//
// Tests that non-public events CANNOT be called from outside their module.
// The events in test_lib/ are NOT marked ~pub, so they should be private.
//
// Structure:
// test_lib/
// graphics.kz -> test_lib.graphics: (NO ~pub markers)
// audio.kz -> test_lib.audio: (NO ~pub markers)
//
// CURRENT STATUS: BUG - This test passes when it should fail.
//
// Expected behavior: SEMANTIC ERROR (not parse error!)
// Koru's parser is intentionally dumb - it doesn't validate visibility.
// The visibility check should happen during event resolution, when we
// verify that a cross-module event reference points to a ~pub event.
//
// TODO: Implement visibility checking in event resolution, then mark
// this test as MUST_FAIL.
//
// See test 110_003 for the SUCCESS case (with ~pub events)
const std = @import("std");
~import "$app/test_lib"
// Initialize graphics subsystem
~app.test_lib.graphics:init()
// Initialize audio subsystem
~app.test_lib.audio:init()
// Render a frame
~app.test_lib.graphics:render(frame: 42)
// Play a sound
~app.test_lib.audio:play(sound: "explosion.wav")
Imported Files
// Audio module for test_lib
const std = @import("std");
~event init {}
~event play { sound: []const u8 }
~proc init {
std.debug.print("Audio initialized\n", .{});
}
~proc play {
std.debug.print("Playing sound: {s}\n", .{sound});
}
// Graphics module for test_lib
const std = @import("std");
~event init {}
~event render { frame: i32 }
~proc init {
std.debug.print("Graphics initialized\n", .{});
}
~proc render {
std.debug.print("Rendering frame {d}\n", .{frame});
}
Test Configuration
Expected Behavior:
FRONTEND_COMPILE_ERROR