diff options
| author | gingerBill <bill@gingerbill.org> | 2024-05-11 13:59:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-05-11 13:59:06 +0100 |
| commit | 8e263de4aa2a48cb26bf235bdad162de5c1547c8 (patch) | |
| tree | f8cbe0ccd4e2f9043dcc4be1c099fab6e1593bcd /src | |
| parent | 811d53b305643607f25718437336c74dffdccb6b (diff) | |
Fix error message handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_decl.cpp | 2 | ||||
| -rw-r--r-- | src/types.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 441c8000d..1ec366ae7 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -1619,7 +1619,7 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de if (e->kind != Entity_Variable) { continue; } - if (is_type_polymorphic(e->type)) { + if (is_type_polymorphic(e->type) && is_type_polymorphic_record_unspecialized(e->type)) { gbString s = type_to_string(e->type); char const *msg = "Unspecialized polymorphic types are not allowed in procedure parameters, got %s"; if (e->Variable.type_expr) { diff --git a/src/types.cpp b/src/types.cpp index 30e009086..47ed86f7a 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -2100,8 +2100,8 @@ gb_internal bool is_type_polymorphic_record_unspecialized(Type *t) { t = base_type(t); if (t->kind == Type_Struct) { return t->Struct.is_polymorphic && !t->Struct.is_poly_specialized; - } else if (t->kind == Type_Struct) { - return t->Struct.is_polymorphic && !t->Struct.is_poly_specialized; + } else if (t->kind == Type_Union) { + return t->Union.is_polymorphic && !t->Union.is_poly_specialized; } return false; } |