1#module=foo=foo.zig
2
3#update=initial version
4#file=main.zig
5pub fn main() void {
6 _ = @import("foo");
7 //_ = @import("other.zig");
8}
9#file=foo.zig
10comptime {
11 _ = @import("other.zig");
12}
13#file=other.zig
14fn f() void {
15 @compileLog(@src().module);
16}
17comptime {
18 f();
19}
20#expect_error=other.zig:2:5: error: found compile log statement
21#expect_compile_log=@as([:0]const u8, "foo"[0..3])
22
23#update=change module of other.zig
24#file=main.zig
25pub fn main() void {
26 _ = @import("foo");
27 _ = @import("other.zig");
28}
29#file=foo.zig
30comptime {
31 //_ = @import("other.zig");
32}
33#expect_error=other.zig:2:5: error: found compile log statement
34#expect_compile_log=@as([:0]const u8, "root"[0..4])
35
36#update=put other.zig in both modules
37#file=main.zig
38pub fn main() void {
39 _ = @import("foo");
40 _ = @import("other.zig");
41}
42#file=foo.zig
43comptime {
44 _ = @import("other.zig");
45}
46#expect_error=foo.zig:1:1: error: file exists in modules 'root' and 'foo'
47#expect_error=foo.zig:1:1: note: files must belong to only one module
48#expect_error=main.zig:3:17: note: file is imported here by the root of module 'root'
49#expect_error=foo.zig:2:17: note: file is imported here by the root of module 'foo'
50
51#update=put other.zig in no modules
52#file=main.zig
53pub fn main() void {
54 _ = @import("foo");
55 //_ = @import("other.zig");
56}
57#file=foo.zig
58comptime {
59 //_ = @import("other.zig");
60}
61#expect_stdout=""