authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-04-26 10:42:09+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-04-26 15:46:58+02:00
log8c5542bd38c4c78139d4f18b83cd8d52e3e71a83
treef947555e5e9efa4abfab1e7752e817a5df409671
parent814988647f3fd96219a1487bf036a8a6b618f3ba

incremental: add test for changing container kind

This used to trigger bugs, but works correctly as of Zig 0.16.0. Resolves: https://github.com/ziglang/zig/issues/24217

1 files changed, 61 insertions(+), 0 deletions(-)

test/incremental/change_container_kind created+61
......@@ -0,0 +1,61 @@
1#update=initial version, T is struct
2#file=main.zig
3const T = @import("foo.zig").T;
4pub fn main() void {
5 @compileLog(T);
6 @compileLog(@tagName(@typeInfo(T)));
7}
8#file=foo.zig
9pub const T = struct { x: u8 };
10#expect_error=main.zig:3:5: error: found compile log statement
11#expect_compile_log=@as(type, foo.T)
12#expect_compile_log=@as(*const [6:0]u8, "struct")
13
14#update=T is union
15#file=foo.zig
16pub const T = union {};
17#expect_error=main.zig:3:5: error: found compile log statement
18#expect_compile_log=@as(type, foo.T)
19#expect_compile_log=@as(*const [5:0]u8, "union")
20
21#update=T is enum
22#file=foo.zig
23pub const T = enum {};
24#expect_error=main.zig:3:5: error: found compile log statement
25#expect_compile_log=@as(type, foo.T)
26#expect_compile_log=@as(*const [4:0]u8, "enum")
27
28#update=T is opaque
29#file=foo.zig
30pub const T = opaque {};
31#expect_error=main.zig:3:5: error: found compile log statement
32#expect_compile_log=@as(type, foo.T)
33#expect_compile_log=@as(*const [6:0]u8, "opaque")
34
35#update=T is packed struct
36#file=foo.zig
37pub const T = packed struct {};
38#expect_error=main.zig:3:5: error: found compile log statement
39#expect_compile_log=@as(type, foo.T)
40#expect_compile_log=@as(*const [6:0]u8, "struct")
41
42#update=T is packed union
43#file=foo.zig
44pub const T = packed union { x: void }; // packed unions need at least 1 field
45#expect_error=main.zig:3:5: error: found compile log statement
46#expect_compile_log=@as(type, foo.T)
47#expect_compile_log=@as(*const [5:0]u8, "union")
48
49#update=T is extern struct
50#file=foo.zig
51pub const T = extern struct {};
52#expect_error=main.zig:3:5: error: found compile log statement
53#expect_compile_log=@as(type, foo.T)
54#expect_compile_log=@as(*const [6:0]u8, "struct")
55
56#update=T is extern union
57#file=foo.zig
58pub const T = extern union { x: void }; // extern unions need at least 1 field
59#expect_error=main.zig:3:5: error: found compile log statement
60#expect_compile_log=@as(type, foo.T)
61#expect_compile_log=@as(*const [5:0]u8, "union")