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