aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-01-01 17:40:40 +0000
committerGitHub <noreply@github.com>2025-01-01 17:40:40 +0000
commitbfbcc02affc9193600a7571d07523a9095efc0d5 (patch)
tree44f1c28da504f1008a735e419277d9b654b08d14
parent8d400f43fd958ae05cd5aaf22993ee73b6347bff (diff)
parent9f77f7c4175a6202b01a984a692c0288ac6077ec (diff)
Merge pull request #4608 from zen3ger/assignment-of-non-specialized-parapoly
Fix crash on assignment of parapoly proc to variable
-rw-r--r--src/check_decl.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index ced886bc9..1d792dad8 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));