1#update=initial version
2#file=main.zig
3pub const A = struct { b: B };
4pub const B = struct { a: A };
5pub fn main() void {
6 _ = @as(B, undefined);
7}
8#expect_error=:error: dependency loop with length 2
9#expect_error=main.zig:2:27: note: type 'main.B' depends on type 'main.A' for field declared here
10#expect_error=main.zig:1:27: note: type 'main.A' depends on type 'main.B' for field declared here
11#expect_error=:note: eliminate any one of these dependencies to break the loop
12
13#update=remove reference to dependency loop
14#file=main.zig
15pub const A = struct { b: B };
16pub const B = struct { a: A };
17pub fn main() void {
18 _ = B;
19}
20#expect_stdout=""
21
22#update=change dependency loop without fixing it
23#file=main.zig
24pub const A = struct { b: B };
25pub const B = struct { a: *align(@alignOf(A)) A };
26pub fn main() void {
27 _ = B;
28}
29#expect_stdout=""
30
31#update=reference dependency loop again
32#file=main.zig
33pub const A = struct { b: B };
34pub const B = struct { a: *align(@alignOf(A)) A };
35pub fn main() void {
36 _ = @as(B, undefined);
37}
38#expect_error=:error: dependency loop with length 2
39#expect_error=main.zig:2:43: note: type 'main.B' depends on type 'main.A' for alignment query here
40#expect_error=main.zig:1:27: note: type 'main.A' depends on type 'main.B' for field declared here
41#expect_error=:note: eliminate any one of these dependencies to break the loop
42
43#update=fix dependency loop
44#file=main.zig
45pub const A = struct { b: B };
46pub const B = struct { a: *A };
47pub fn main() void {
48 _ = @as(B, undefined);
49}
50#expect_stdout=""