diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2023-02-28 12:15:54 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-28 12:15:54 +0000 |
| commit | 9afd9f9beae310d2a3bea98cd713b22d2f167cf9 (patch) | |
| tree | 1f5ed60d50eeb282ae4dd451dfe75fab73e32052 /src/check_type.cpp | |
| parent | eb60ec3899922b6b98a5ee1a00766d5d9b9917e1 (diff) | |
| parent | c8d3a9121bbed1cff1fee45d6ecf0fa4748f4d21 (diff) | |
Merge branch 'master' into new-temp-allocator
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index ec661134b..fabbe54c4 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1309,6 +1309,8 @@ gb_internal ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_ init_core_source_code_location(ctx->checker); param_value.kind = ParameterValue_Location; o.type = t_source_code_location; + o.mode = Addressing_Value; + o.expr = expr; if (in_type) { check_assignment(ctx, &o, in_type, str_lit("parameter value")); @@ -1666,17 +1668,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; } } |