aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-08-16 16:37:27 +0300
committerVeikka Tuominen <git@vexu.eu>2022-08-16 16:37:27 +0300
commitc17793b4875cc9e1ccb605431142ffecb0b6f3f2 (patch)
treec2304b0cb0458e8ea78e6a7575a414f84a071ea6 /test/behavior/basic.zig
parentb3922289be1ffaf194b55face332892280981356 (diff)
downloadzig-c17793b4875cc9e1ccb605431142ffecb0b6f3f2.tar.gz
zig-c17793b4875cc9e1ccb605431142ffecb0b6f3f2.zip
Sema: ignore current declaration in ambiguous reference error
Closes #12429
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 1a1412420a..4d8b176fbf 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1104,3 +1104,24 @@ test "namespace lookup ignores decl causing the lookup" {
};
_ = S.foo();
}
+
+test "ambiguous reference error ignores current declaration" {
+ const S = struct {
+ const foo = 666;
+
+ const a = @This();
+ const b = struct {
+ const foo = a.foo;
+ const bar = struct {
+ bar: u32 = b.foo,
+ };
+
+ comptime {
+ _ = b.foo;
+ }
+ };
+
+ usingnamespace b;
+ };
+ try expect(S.b.foo == 666);
+}