mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Sema: add missing failWithBadMemberAccess to zirExport
The assumption that AstGen would error only holds when exporting a identifier not a namespace member.
This commit is contained in:
parent
4b0ef6a409
commit
b2b1d421c3
@ -5391,7 +5391,8 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
|
||||
const container_namespace = container_ty.getNamespace().?;
|
||||
|
||||
const maybe_index = try sema.lookupInNamespace(block, operand_src, container_namespace, decl_name, false);
|
||||
break :index_blk maybe_index.?; // AstGen would produce error in case of unidentified name
|
||||
break :index_blk maybe_index orelse
|
||||
return sema.failWithBadMemberAccess(block, container_ty, operand_src, decl_name);
|
||||
} else try sema.lookupIdentifier(block, operand_src, decl_name);
|
||||
const options = sema.resolveExportOptions(block, .unneeded, extra.options) catch |err| switch (err) {
|
||||
error.NeededSourceLocation => {
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
const S = struct {};
|
||||
comptime {
|
||||
@export(S.foo, .{ .name = "foo" });
|
||||
}
|
||||
|
||||
// error
|
||||
// target=native
|
||||
//
|
||||
// :3:14: error: struct 'tmp.S' has no member named 'foo'
|
||||
// :1:11: note: struct declared here
|
||||
Loading…
x
Reference in New Issue
Block a user