diff options
| author | gingerBill <bill@gingerbill.org> | 2025-04-09 13:29:56 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2025-04-09 13:29:56 +0100 |
| commit | a15b36792118ffd4f69e04754cd5b7081c6eb296 (patch) | |
| tree | f86121f471120c0e1c7f9e4f2e2a7c440c832ce0 /src/check_type.cpp | |
| parent | 377e4e11edbcddc22bb2ea697aa9de649f7542e2 (diff) | |
Fix #5015
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index cd55bfdc0..4fa02fd5f 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -3504,6 +3504,16 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T elem = o.type; } + if (!ctx->in_polymorphic_specialization && ctx->disallow_polymorphic_return_types) { + Type *t = base_type(elem); + if (t != nullptr && + is_type_polymorphic_record_unspecialized(t)) { + gbString err_str = expr_to_string(e); + error(e, "Invalid use of a non-specialized polymorphic type '%s'", err_str); + gb_string_free(err_str); + } + } + if (pt->tag != nullptr) { GB_ASSERT(pt->tag->kind == Ast_BasicDirective); |