diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-08-16 16:55:49 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-08-16 20:35:03 +0300 |
| commit | 9d4561ef0082728bbba085e8a4689ccc93a37b27 (patch) | |
| tree | 8bb2dd3845b94629b49c0a778999d9dcdf2a9f47 /test/cases/compile_errors | |
| parent | c17793b4875cc9e1ccb605431142ffecb0b6f3f2 (diff) | |
| download | zig-9d4561ef0082728bbba085e8a4689ccc93a37b27.tar.gz zig-9d4561ef0082728bbba085e8a4689ccc93a37b27.zip | |
AstGen: detect declarations shadowing locals
Closes #9355
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/decl_shadows_local.zig | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/cases/compile_errors/decl_shadows_local.zig b/test/cases/compile_errors/decl_shadows_local.zig new file mode 100644 index 0000000000..cb48cafa45 --- /dev/null +++ b/test/cases/compile_errors/decl_shadows_local.zig @@ -0,0 +1,22 @@ +fn foo(a: usize) void { + struct { + const a = 1; + }; +} +fn bar(a: usize) void { + struct { + const b = struct { + const a = 1; + }; + }; + _ = a; +} + +// error +// backend=stage2 +// target=native +// +// :3:15: error: redeclaration of function parameter 'a' +// :1:8: note: previous declaration here +// :9:19: error: redeclaration of function parameter 'a' +// :6:8: note: previous declaration here |
