aboutsummaryrefslogtreecommitdiff
path: root/test/incremental/change_module
blob: 7a198721eee0c52977710c0bf7824ff6b0d99ec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted
#module=foo=foo.zig

#update=initial version
#file=main.zig
pub fn main() void {
    _ = @import("foo");
    //_ = @import("other.zig");
}
#file=foo.zig
comptime {
    _ = @import("other.zig");
}
#file=other.zig
fn f() void {
    @compileLog(@src().module);
}
comptime {
    f();
}
#expect_error=other.zig:2:5: error: found compile log statement
#expect_compile_log=@as([:0]const u8, "foo"[0..3])

#update=change module of other.zig
#file=main.zig
pub fn main() void {
    _ = @import("foo");
    _ = @import("other.zig");
}
#file=foo.zig
comptime {
    //_ = @import("other.zig");
}
#expect_error=other.zig:2:5: error: found compile log statement
#expect_compile_log=@as([:0]const u8, "root"[0..4])

#update=put other.zig in both modules
#file=main.zig
pub fn main() void {
    _ = @import("foo");
    _ = @import("other.zig");
}
#file=foo.zig
comptime {
    _ = @import("other.zig");
}
#expect_error=foo.zig:1:1: error: file exists in modules 'root' and 'foo'
#expect_error=foo.zig:1:1: note: files must belong to only one module
#expect_error=main.zig:3:17: note: file is imported here by the root of module 'root'
#expect_error=foo.zig:2:17: note: file is imported here by the root of module 'foo'

#update=put other.zig in no modules
#file=main.zig
pub fn main() void {
    _ = @import("foo");
    //_ = @import("other.zig");
}
#file=foo.zig
comptime {
    //_ = @import("other.zig");
}
#expect_stdout=""