diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-05-09 08:35:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 08:35:16 +0100 |
| commit | 23aff08556589a80d886cceb3482428507e7c46f (patch) | |
| tree | 9ee38691a31346fdc534976cca8cbfea259a5045 /src/check_type.cpp | |
| parent | 10d83323949a11364c77c6a6c32196990509870b (diff) | |
| parent | 3c0ba5bb55fe59ed1644c3e61fd2a81fb856624e (diff) | |
Merge pull request #5117 from bogwi/bug/5024
Bug/5024
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 452da4023..431698459 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1910,9 +1910,18 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para case ParameterValue_Location: case ParameterValue_Expression: case ParameterValue_Value: + // Special case for polymorphic procedures as default values + if (param_value.ast_value != nullptr) { + Entity *e = entity_from_expr(param_value.ast_value); + if (e != nullptr && e->kind == Entity_Procedure && is_type_polymorphic(e->type)) { + // Allow polymorphic procedures as default parameter values + // The type will be correctly determined at call site + break; + } + } gbString str = type_to_string(type); error(params[i], "A default value for a parameter must not be a polymorphic constant type, got %s", str); - gb_string_free(str); + gb_string_free(str); break; } } |