diff options
| author | gingerBill <bill@gingerbill.org> | 2023-02-17 13:00:37 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-02-17 13:00:37 +0000 |
| commit | 8a2a70a3c2a7ac14687d100325e12b8d3d02256e (patch) | |
| tree | 489a1432554e70596c1c44637df84d5c5edcc938 /src/check_type.cpp | |
| parent | 210f47b8abef40db3229e772e6063d044fa4c895 (diff) | |
Fix overriding procedure information for literals
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index ec661134b..24ca8628e 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1666,17 +1666,21 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para if (is_poly_name) { bool valid = false; if (is_type_proc(op.type)) { - Entity *proc_entity = entity_from_expr(op.expr); - valid = (proc_entity != nullptr) && (op.value.kind == ExactValue_Procedure); - if (valid) { + Ast *expr = unparen_expr(op.expr); + Entity *proc_entity = entity_from_expr(expr); + if (proc_entity) { poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr); + valid = true; + } else if (expr->kind == Ast_ProcLit) { + poly_const = exact_value_procedure(expr); + valid = true; } } if (!valid) { if (op.mode == Addressing_Constant) { poly_const = op.value; } else { - error(op.expr, "Expected a constant value for this polymorphic name parameter"); + error(op.expr, "Expected a constant value for this polymorphic name parameter, got %s", expr_to_string(op.expr)); success = false; } } |