diff options
| author | Roland Kovacs <zen3ger@tutanota.com> | 2024-12-22 12:38:37 +0100 |
|---|---|---|
| committer | Roland Kovacs <zen3ger@tutanota.com> | 2024-12-22 12:38:37 +0100 |
| commit | 9f77f7c4175a6202b01a984a692c0288ac6077ec (patch) | |
| tree | 04745544be1e416241b5078ee1d242b27fb08048 /src/check_decl.cpp | |
| parent | 597fba7c31f5e927b0c7431444dad132352b4046 (diff) | |
Fix crash on assignment of parapoly proc to variable
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 60eb030ff..d541426d3 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -94,12 +94,14 @@ gb_internal Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *o return nullptr; } if (e2->state.load() != EntityState_Resolved) { - gbString str = type_to_string(t); - defer (gb_string_free(str)); - error(e->token, "Invalid use of a polymorphic type '%s' in %.*s", str, LIT(context_name)); - e->type = t_invalid; + e->type = t; return nullptr; } + gbString str = type_to_string(t); + defer (gb_string_free(str)); + error(operand->expr, "Invalid use of a non-specialized polymorphic type '%s' in %.*s", str, LIT(context_name)); + e->type = t_invalid; + return nullptr; } else if (is_type_empty_union(t)) { gbString str = type_to_string(t); defer (gb_string_free(str)); |