mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
parent
4a5cd0b895
commit
c40448eb9a
@ -4367,6 +4367,13 @@ static void add_symbols_from_import(CodeGen *g, AstNode *src_use_node, AstNode *
|
||||
ZigType *target_import = use_target_value->data.x_type;
|
||||
assert(target_import);
|
||||
|
||||
if (target_import->id != ZigTypeIdStruct) {
|
||||
add_node_error(g, dst_use_node,
|
||||
buf_sprintf("expected struct, found '%s'", buf_ptr(&target_import->name)));
|
||||
get_container_scope(dst_use_node->owner)->any_imports_failed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_container_scope(target_import)->any_imports_failed) {
|
||||
get_container_scope(dst_use_node->owner)->any_imports_failed = true;
|
||||
}
|
||||
|
||||
@ -2,6 +2,13 @@ const tests = @import("tests.zig");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||
cases.add(
|
||||
"usingnamespace with wrong type",
|
||||
\\use void;
|
||||
,
|
||||
"tmp.zig:1:1: error: expected struct, found 'void'",
|
||||
);
|
||||
|
||||
cases.add(
|
||||
"ignored expression in while continuation",
|
||||
\\export fn a() void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user