From a7dd34bfc57f4f84bb5290177f26e2d1f0bdc27e Mon Sep 17 00:00:00 2001 From: mlugg Date: Wed, 16 Oct 2024 14:21:13 +0100 Subject: [PATCH] incremental: add new test case This isn't exactly the case provided in #11290, but is a slightly simpler case which I know would have triggered the same bug in the old implementation of incremental compilation. Resolves: #11290 --- .../remove_invalid_union_backing_enum | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/incremental/remove_invalid_union_backing_enum diff --git a/test/incremental/remove_invalid_union_backing_enum b/test/incremental/remove_invalid_union_backing_enum new file mode 100644 index 0000000000..ded6304531 --- /dev/null +++ b/test/incremental/remove_invalid_union_backing_enum @@ -0,0 +1,30 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +const E = enum { a, b, c }; +const U = union(E) { + a: i32, + b: f64, + c: f64, + d: f64, +}; +pub fn main() void { + const u: U = .{ .a = 123 }; + _ = u; +} +#expect_error=ignored +#update=remove invalid backing enum +#file=main.zig +const U = union { + a: i32, + b: f64, + c: f64, + d: f64, +}; +pub fn main() void { + const u: U = .{ .a = 123 }; + _ = u; +} +#expect_stdout=""