mirror of
https://github.com/ziglang/zig.git
synced 2026-01-30 03:03:46 +00:00
fix undeclared identifier not marking function as impure
This commit is contained in:
parent
6acc354957
commit
ae600d2f7f
@ -2814,6 +2814,7 @@ static TypeTableEntry *analyze_symbol_expr(CodeGen *g, ImportTableEntry *import,
|
||||
return g->builtin_types.entry_invalid;
|
||||
}
|
||||
|
||||
mark_impure_fn(context);
|
||||
add_node_error(g, node, buf_sprintf("use of undeclared identifier '%s'", buf_ptr(variable_name)));
|
||||
return g->builtin_types.entry_invalid;
|
||||
}
|
||||
|
||||
@ -1209,6 +1209,15 @@ const a = get_it();
|
||||
#static_eval_enable(false)
|
||||
fn get_it() -> Foo { Foo {.x = 13} }
|
||||
)SOURCE", 1, ".tmp_source.zig:5:17: error: unable to evaluate constant expression");
|
||||
|
||||
add_compile_fail_case("undeclared identifier error should mark fn as impure", R"SOURCE(
|
||||
fn foo() {
|
||||
test_a_thing();
|
||||
}
|
||||
fn test_a_thing() {
|
||||
bad_fn_call();
|
||||
}
|
||||
)SOURCE", 1, ".tmp_source.zig:6:5: error: use of undeclared identifier 'bad_fn_call'");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user