From 7b612a3a1587edcafc6301785a3f126fee692eb9 Mon Sep 17 00:00:00 2001 From: LeandroLibanio28H Date: Mon, 2 Jun 2025 20:14:19 -0300 Subject: [PATCH 1/3] Checking if entity is exported before checking if it's a procedure group --- src/check_expr.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 20918c8f9..12655460b 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1,3 +1,5 @@ +#include + enum CallArgumentError { CallArgumentError_None, CallArgumentError_NoneProcedureType, @@ -5373,16 +5375,6 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod return nullptr; } - check_entity_decl(c, entity, nullptr, nullptr); - if (entity->kind == Entity_ProcGroup) { - operand->mode = Addressing_ProcGroup; - operand->proc_group = entity; - - add_type_and_value(c, operand->expr, operand->mode, operand->type, operand->value); - return entity; - } - GB_ASSERT_MSG(entity->type != nullptr, "%.*s (%.*s)", LIT(entity->token.string), LIT(entity_strings[entity->kind])); - if (!is_entity_exported(entity, allow_builtin)) { gbString sel_str = expr_to_string(selector); error(node, "'%s' is not exported by '%.*s'", sel_str, LIT(import_name)); @@ -5393,6 +5385,16 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod // return nullptr; } + check_entity_decl(c, entity, nullptr, nullptr); + if (entity->kind == Entity_ProcGroup) { + operand->mode = Addressing_ProcGroup; + operand->proc_group = entity; + + add_type_and_value(c, operand->expr, operand->mode, operand->type, operand->value); + return entity; + } + GB_ASSERT_MSG(entity->type != nullptr, "%.*s (%.*s)", LIT(entity->token.string), LIT(entity_strings[entity->kind])); + if (entity->kind == Entity_ProcGroup) { Array procs = entity->ProcGroup.entities; bool skip = false; From e6b086e78d2b8619fccd86108b4725d3d2de4a59 Mon Sep 17 00:00:00 2001 From: LeandroLibanio28H Date: Mon, 2 Jun 2025 20:48:25 -0300 Subject: [PATCH 2/3] Removing unreacheable block (since e86fde3) --- src/check_expr.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 12655460b..a60eaaf3d 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -5394,37 +5394,6 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod return entity; } GB_ASSERT_MSG(entity->type != nullptr, "%.*s (%.*s)", LIT(entity->token.string), LIT(entity_strings[entity->kind])); - - if (entity->kind == Entity_ProcGroup) { - Array procs = entity->ProcGroup.entities; - bool skip = false; - for (Entity *p : procs) { - Type *t = base_type(p->type); - if (t == t_invalid) { - continue; - } - - Operand x = {}; - x.mode = Addressing_Value; - x.type = t; - if (type_hint != nullptr) { - if (check_is_assignable_to(c, &x, type_hint)) { - entity = p; - skip = true; - break; - } - } - } - - if (!skip) { - GB_ASSERT(entity != nullptr); - operand->mode = Addressing_ProcGroup; - operand->type = t_invalid; - operand->expr = node; - operand->proc_group = entity; - return entity; - } - } } } From 0f5e30783cd3b13ff41a2e57f68795e02502c27c Mon Sep 17 00:00:00 2001 From: Leandro Libanio Date: Tue, 3 Jun 2025 08:55:38 -0300 Subject: [PATCH 3/3] Update check_expr.cpp Removing iostream --- src/check_expr.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index a60eaaf3d..d4c173adc 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1,5 +1,3 @@ -#include - enum CallArgumentError { CallArgumentError_None, CallArgumentError_NoneProcedureType,