Skip to content

Commit 9f0d142

Browse files
committed
Zcu: preserve ordering of usingnamespace decls
See comment. This slightly regresses a previous fix from this branch. A proper solution will come soon, with the splitting up of `Decl` into `Cau` and `Nav`.
1 parent db66f3b commit 9f0d142

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Module.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4358,7 +4358,10 @@ fn scanDecl(iter: *ScanDeclIter, decl_inst: Zir.Inst.Index) Allocator.Error!void
43584358
};
43594359
},
43604360
.@"usingnamespace" => info: {
4361-
if (iter.pass != .unnamed) return;
4361+
// TODO: this isn't right! These should be considered unnamed. Name conflicts can happen here.
4362+
// The problem is, we need to preserve the decl ordering for `@typeInfo`.
4363+
// I'm not bothering to fix this now, since some upcoming changes will change this code significantly anyway.
4364+
if (iter.pass != .named) return;
43624365
const i = iter.usingnamespace_index;
43634366
iter.usingnamespace_index += 1;
43644367
break :info .{

0 commit comments

Comments
 (0)