From 1c3596242839a8521b65890b15117d305d0b9fb7 Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Sun, 26 Apr 2026 10:42:09 +0100 Subject: [PATCH] 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 --- test/incremental/change_container_kind | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 test/incremental/change_container_kind diff --git a/test/incremental/change_container_kind b/test/incremental/change_container_kind new file mode 100644 index 0000000000..cf6b5a3689 --- /dev/null +++ b/test/incremental/change_container_kind @@ -0,0 +1,61 @@ +#update=initial version, T is struct +#file=main.zig +const T = @import("foo.zig").T; +pub fn main() void { + @compileLog(T); + @compileLog(@tagName(@typeInfo(T))); +} +#file=foo.zig +pub const T = struct { x: u8 }; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [6:0]u8, "struct") + +#update=T is union +#file=foo.zig +pub const T = union {}; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [5:0]u8, "union") + +#update=T is enum +#file=foo.zig +pub const T = enum {}; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [4:0]u8, "enum") + +#update=T is opaque +#file=foo.zig +pub const T = opaque {}; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [6:0]u8, "opaque") + +#update=T is packed struct +#file=foo.zig +pub const T = packed struct {}; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [6:0]u8, "struct") + +#update=T is packed union +#file=foo.zig +pub const T = packed union { x: void }; // packed unions need at least 1 field +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [5:0]u8, "union") + +#update=T is extern struct +#file=foo.zig +pub const T = extern struct {}; +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [6:0]u8, "struct") + +#update=T is extern union +#file=foo.zig +pub const T = extern union { x: void }; // extern unions need at least 1 field +#expect_error=main.zig:3:5: error: found compile log statement +#expect_compile_log=@as(type, foo.T) +#expect_compile_log=@as(*const [5:0]u8, "union")