mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
Merge pull request 'incremental: fix tracking of nested container declarations (and of opaque types)' (#31889) from dont-track-children-if-lost-parent into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31889 Reviewed-by: Andrew Kelley <andrew@ziglang.org>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
pub fn main() void {
|
||||
_ = @as(S, undefined);
|
||||
}
|
||||
// To reproduce the original bug, the inner struct must perform a namespace lookup
|
||||
// or a scope lookup when resolving its field type.
|
||||
const SomeType = u8;
|
||||
const S = struct {
|
||||
foo: struct { inner: SomeType },
|
||||
};
|
||||
#expect_stdout=""
|
||||
#update=add field to outer struct, change decl used by inner struct
|
||||
#file=main.zig
|
||||
pub fn main() void {
|
||||
_ = @as(S, undefined);
|
||||
}
|
||||
// To reproduce the original bug, the inner struct must perform a namespace lookup
|
||||
// or a scope lookup when resolving its field type.
|
||||
const SomeType = u16;
|
||||
const S = struct {
|
||||
foo: struct { inner: SomeType },
|
||||
bar: u32,
|
||||
};
|
||||
#expect_stdout=""
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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=""
|
||||
Reference in New Issue
Block a user