diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-11-04 10:11:33 +0100 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2019-11-04 20:33:40 +0100 |
| commit | 61825062aadd68e6cd2e864c717b3a8ce482258d (patch) | |
| tree | 676f66143eae2742792f6701072a790ae9744f6a /src/analyze.cpp | |
| parent | c8b6e552991136e3a45095007ae4c3594be02ef9 (diff) | |
| download | zig-61825062aadd68e6cd2e864c717b3a8ce482258d.tar.gz zig-61825062aadd68e6cd2e864c717b3a8ce482258d.zip | |
Correctly process errors for invalid types in fn call
Fixes #3544
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index e38470f7f9..9c7ee3ca53 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -4238,7 +4238,8 @@ AstNode *get_param_decl_node(ZigFn *fn_entry, size_t index) { return nullptr; } -static void define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) { +static Error define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) { + Error err; ZigType *fn_type = fn_table_entry->type_entry; assert(!fn_type->data.fn.is_generic); FnTypeId *fn_type_id = &fn_type->data.fn.fn_type_id; @@ -4257,8 +4258,11 @@ static void define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) { } ZigType *param_type = param_info->type; - bool is_noalias = param_info->is_noalias; + if ((err = type_resolve(g, param_type, ResolveStatusSizeKnown))) { + return err; + } + bool is_noalias = param_info->is_noalias; if (is_noalias && get_codegen_ptr_type(param_type) == nullptr) { add_node_error(g, param_decl_node, buf_sprintf("noalias on non-pointer parameter")); } @@ -4273,6 +4277,8 @@ static void define_local_param_variables(CodeGen *g, ZigFn *fn_table_entry) { fn_table_entry->variable_list.append(var); } } + + return ErrorNone; } bool resolve_inferred_error_set(CodeGen *g, ZigType *err_set_type, AstNode *source_node) { @@ -4596,7 +4602,10 @@ static void analyze_fn_body(CodeGen *g, ZigFn *fn_table_entry) { if (!fn_table_entry->child_scope) fn_table_entry->child_scope = &fn_table_entry->fndef_scope->base; - define_local_param_variables(g, fn_table_entry); + if (define_local_param_variables(g, fn_table_entry) != ErrorNone) { + fn_table_entry->anal_state = FnAnalStateInvalid; + return; + } ZigType *fn_type = fn_table_entry->type_entry; assert(!fn_type->data.fn.is_generic); |
