| author | |
| committer | |
| log | 6b037bad590bd6c319af336b6d3017c33d6834ba |
| tree | 86557878d6d467a6836c6dd1c74028c6f3b21120 |
| parent | 94be9dcc7f2ff81c3433cd2f8bb32f7ea53ba7cf |
This matches stage1 behavior.
Closes #143222 files changed, 14 insertions(+), 0 deletions(-)
src/Sema.zig+1| ... | ... | @@ -16258,6 +16258,7 @@ fn typeInfoNamespaceDecls( |
| 16258 | 16258 | for (decls) |decl_index| { |
| 16259 | 16259 | const decl = sema.mod.declPtr(decl_index); |
| 16260 | 16260 | if (decl.kind == .@"usingnamespace") { |
| 16261 | if (decl.analysis == .in_progress) continue; | |
| 16261 | 16262 | try sema.mod.ensureDeclAnalyzed(decl_index); |
| 16262 | 16263 | var buf: Value.ToTypeBuffer = undefined; |
| 16263 | 16264 | const new_ns = decl.val.toType(&buf).getNamespace().?; |
test/behavior/type_info.zig+13| ... | ... | @@ -590,3 +590,16 @@ test "@typeInfo decls and usingnamespace" { |
| 590 | 590 | try expectEqualStrings(decls[1].name, "y"); |
| 591 | 591 | try expectEqualStrings(decls[2].name, "z"); |
| 592 | 592 | } |
| 593 | ||
| 594 | test "@typeInfo decls ignore dependency loops" { | |
| 595 | const S = struct { | |
| 596 | fn Def(comptime T: type) type { | |
| 597 | std.debug.assert(@typeInfo(T).Struct.decls.len == 1); | |
| 598 | return struct { | |
| 599 | const foo = u32; | |
| 600 | }; | |
| 601 | } | |
| 602 | usingnamespace Def(@This()); | |
| 603 | }; | |
| 604 | _ = S.foo; | |
| 605 | } |