From 7c3237019454a6009d96eca31f36a1d9e6ce02aa Mon Sep 17 00:00:00 2001 From: mlugg Date: Wed, 13 Mar 2024 19:16:09 +0000 Subject: [PATCH] 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`. --- src/Module.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Module.zig b/src/Module.zig index 95b96b360552..8f6def21ae6d 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -4358,7 +4358,10 @@ fn scanDecl(iter: *ScanDeclIter, decl_inst: Zir.Inst.Index) Allocator.Error!void }; }, .@"usingnamespace" => info: { - if (iter.pass != .unnamed) return; + // TODO: this isn't right! These should be considered unnamed. Name conflicts can happen here. + // The problem is, we need to preserve the decl ordering for `@typeInfo`. + // I'm not bothering to fix this now, since some upcoming changes will change this code significantly anyway. + if (iter.pass != .named) return; const i = iter.usingnamespace_index; iter.usingnamespace_index += 1; break :info .{