AstGen: allow locals with same name as primitives with @"" syntax

This makes local names follow the same rule as declaration names.
This commit is contained in:
Andrew Kelley
2021-08-28 10:17:47 -07:00
parent f30aa25cbf
commit 6a6e2cd64f
3 changed files with 41 additions and 29 deletions

View File

@@ -7264,14 +7264,9 @@ pub fn addCases(ctx: *TestContext) !void {
\\ const a: u8 = 300;
\\ _ = a;
\\}
\\export fn bar() void {
\\ const @"u8" = u16;
\\ const a: @"u8" = 300;
\\ _ = a;
\\}
, &[_][]const u8{
"tmp.zig:2:11: error: local shadows primitive 'u8'",
"tmp.zig:7:11: error: local shadows primitive 'u8'",
"tmp.zig:2:11: error: name shadows primitive 'u8'",
"tmp.zig:2:11: note: consider using @\"u8\" to disambiguate",
});
ctx.objErrStage1("primitives take precedence over declarations",