Merge pull request #2027 from thePHTest/poly-proc

fix polymorphic proc parameters error handling
This commit is contained in:
Jeroen van Rijn
2022-09-06 20:33:47 +02:00
committed by GitHub
+3 -1
View File
@@ -1643,9 +1643,11 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is
bool valid = false; bool valid = false;
if (is_type_proc(op.type)) { if (is_type_proc(op.type)) {
Entity *proc_entity = entity_from_expr(op.expr); Entity *proc_entity = entity_from_expr(op.expr);
valid = proc_entity != nullptr; valid = (proc_entity != nullptr) && (op.value.kind == ExactValue_Procedure);
if (valid) {
poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr); poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr);
} }
}
if (!valid) { if (!valid) {
if (op.mode == Addressing_Constant) { if (op.mode == Addressing_Constant) {
poly_const = op.value; poly_const = op.value;