File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -5384,6 +5384,17 @@ fn lookupInNamespace(
5384
5384
}
5385
5385
}
5386
5386
5387
+ {
5388
+ var i: usize = 0;
5389
+ while (i < candidates.items.len) {
5390
+ if (candidates.items[i] == sema.owner_decl_index) {
5391
+ _ = candidates.orderedRemove(i);
5392
+ } else {
5393
+ i += 1;
5394
+ }
5395
+ }
5396
+ }
5397
+
5387
5398
switch (candidates.items.len) {
5388
5399
0 => {},
5389
5400
1 => {
Original file line number Diff line number Diff line change @@ -1104,3 +1104,24 @@ test "namespace lookup ignores decl causing the lookup" {
1104
1104
};
1105
1105
_ = S .foo ();
1106
1106
}
1107
+
1108
+ test "ambiguous reference error ignores current declaration" {
1109
+ const S = struct {
1110
+ const foo = 666 ;
1111
+
1112
+ const a = @This ();
1113
+ const b = struct {
1114
+ const foo = a .foo ;
1115
+ const bar = struct {
1116
+ bar : u32 = b .foo ,
1117
+ };
1118
+
1119
+ comptime {
1120
+ _ = b .foo ;
1121
+ }
1122
+ };
1123
+
1124
+ usingnamespace b ;
1125
+ };
1126
+ try expect (S .b .foo == 666 );
1127
+ }
You can’t perform that action at this time.
0 commit comments