| author | |
| committer | |
| log | 4585cb1e2ff6afdb23748bd020ccf8e850550510 |
| tree | 543dc8dd76da0bbb33dc90ada4af91afafd5a7cb |
| parent | 3fc74135749e32ba106572ed85a2e253b89fb0c6 |
This required a third `if (found_already == null)` in another place in
AstGen.zig for this special case of `@export`.
Fixes #171883 files changed, 14 insertions(+), 1 deletions(-)
src/AstGen.zig+4| ... | ... | @@ -8294,6 +8294,10 @@ fn builtinCall( |
| 8294 | 8294 | }, |
| 8295 | 8295 | .top => break, |
| 8296 | 8296 | }; |
| 8297 | if (found_already == null) { | |
| 8298 | const ident_name = try astgen.identifierTokenString(ident_token); | |
| 8299 | return astgen.failNode(params[0], "use of undeclared identifier '{s}'", .{ident_name}); | |
| 8300 | } | |
| 8297 | 8301 | }, |
| 8298 | 8302 | .field_access => { |
| 8299 | 8303 | const namespace_node = node_datas[params[0]].lhs; |
src/Sema.zig+1-1| ... | ... | @@ -6412,7 +6412,7 @@ fn lookupIdentifier(sema: *Sema, block: *Block, src: LazySrcLoc, name: InternPoo |
| 6412 | 6412 | } |
| 6413 | 6413 | namespace = mod.namespacePtr(namespace).parent.unwrap() orelse break; |
| 6414 | 6414 | } |
| 6415 | unreachable; // AstGen detects use of undeclared identifier errors. | |
| 6415 | unreachable; // AstGen detects use of undeclared identifiers. | |
| 6416 | 6416 | } |
| 6417 | 6417 | |
| 6418 | 6418 | /// This looks up a member of a specific namespace. It is affected by `usingnamespace` but |
test/cases/compile_errors/@export_with_undeclared_identifier.zig created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | export fn a() void { | |
| 2 | @export(bogus, .{ .name = "bogus_alias" }); | |
| 3 | } | |
| 4 | ||
| 5 | // error | |
| 6 | // backend=stage2 | |
| 7 | // target=native | |
| 8 | // | |
| 9 | // :2:13: error: use of undeclared identifier 'bogus' |