-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.15.0-dev.1276+3fbdd58a8
Steps to Reproduce and Observed Behavior
Referencing types that contain cyclic types using @typeInfo will trigger the error struct 'T' depends on itself. This error will not occur if the self referential type is resolved first.
const A = struct {
b: *B,
};
const B = struct {
a: a: { _ = @typeInfo(A); break :a void; },
};
const C = struct {
a: a: { _ = @typeInfo(A); break :a void; },
};
test {
_ = @as(C, undefined); // error: struct 'main.A' depends on itself
}
test {
_ = @as(B, undefined);
_ = @as(C, undefined); // no error
}
Expected Behavior
Both tests should compile without errors
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.