mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
6608b65100
...but not in the way you'd expect. We were actually tracking them in cases where we shouldn't have been! We cannot track a declaration if its parent namespace has been lost, because that will cause analysis failures immediately, but if we excluded a type from the mapping due to a major change (such as a struct turning into a union, or a field being added), we were still including any trackable instructions inside the container's field expressions (e.g. struct field type expressions). This meant we were tracking a type declaration while losing tracking on its parent namespace, with predictably disastrous results. Oh, also, tracking for opaque types was just totally wrong (I think this was a typo from a while back). We could map it to things other than opaque declarations, and we never mapped declarations inside opaques. So, uh, I fixed that too.
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
// TODO: it'd be great if we could actually check that no analysis happened!
|
|
#update=initial version
|
|
#file=main.zig
|
|
pub fn main() void {
|
|
const ptr: *const O = @ptrFromInt(0x1000);
|
|
_ = ptr;
|
|
}
|
|
const S = struct { foo: u32, nested: struct { x: u16 } };
|
|
const U = union(enum) { a, b, c: S };
|
|
const E = enum(u8) { a = @typeInfo(U).@"union".fields.len, b = 0, c };
|
|
const O = opaque {
|
|
comptime {
|
|
_ = @as(S, undefined);
|
|
_ = @as(U, undefined);
|
|
_ = @as(E, undefined);
|
|
const Wrapper = struct { val: S };
|
|
const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
|
|
_ = wrapper;
|
|
}
|
|
};
|
|
#expect_stdout=""
|
|
#update=do literally nothing
|
|
#file=main.zig
|
|
pub fn main() void {
|
|
const ptr: *const O = @ptrFromInt(0x1000);
|
|
_ = ptr;
|
|
}
|
|
const S = struct { foo: u32, nested: struct { x: u16 } };
|
|
const U = union(enum) { a, b, c: S };
|
|
const E = enum(u8) { a = @typeInfo(U).@"union".fields.len, b = 0, c };
|
|
const O = opaque {
|
|
comptime {
|
|
_ = @as(S, undefined);
|
|
_ = @as(U, undefined);
|
|
_ = @as(E, undefined);
|
|
const Wrapper = struct { val: S };
|
|
const wrapper: Wrapper = .{ .val = .{ .foo = 123, .nested = .{ .x = 456 } } };
|
|
_ = wrapper;
|
|
}
|
|
};
|
|
#expect_stdout=""
|