forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
incremental: fix adding/removing aggregate fields
I don't recall why I put these checks here -- they aren't correct. We can freely recreate a type even if its fields have changed, because we are going to re-do all type resolution. The only conditions for recreations are (a) the ZIR index must not be lost and (b) the number of captures must be the same. These conditions are permissible because if either is violated, we can guarantee that analysis of a valid `zirStructDecl` (etc) will never reference this type (since the ZIR index has just been tracked, and the captures have just been created based on the ZIR). Adds a corresponding test case. Resolves: ziglang#21185
- Loading branch information
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#target=x86_64-linux | ||
#update=initial version | ||
#file=main.zig | ||
const MyEnum = enum(u8) { | ||
foo = 1, | ||
bar = 2, | ||
}; | ||
pub fn main() !void { | ||
try std.io.getStdOut().writer().print("{}\n", .{@intFromEnum(MyEnum.foo)}); | ||
} | ||
const std = @import("std"); | ||
#expect_stdout="1\n" | ||
#update=remove enum field | ||
#file=main.zig | ||
const MyEnum = enum(u8) { | ||
//foo = 1, | ||
bar = 2, | ||
}; | ||
pub fn main() !void { | ||
try std.io.getStdOut().writer().print("{}\n", .{@intFromEnum(MyEnum.foo)}); | ||
} | ||
const std = @import("std"); | ||
#expect_error=ignored |