aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-08-18 12:10:46 +0100
committergingerBill <bill@gingerbill.org>2024-08-18 12:10:46 +0100
commit60b2979cfd5586175cc8314c8711addc19a07f0c (patch)
tree3b19ae5e0e19f63a496aa03ad3df83d1cfb928fa /src
parent17740966e5dc1581e91f87c616aedc9df8838f1c (diff)
Fix #4024
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index d208be642..9e13b0f24 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -5168,7 +5168,14 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
add_entity_use(c, op_expr, e);
expr_entity = e;
- if (e != nullptr && e->kind == Entity_ImportName && selector->kind == Ast_Ident) {
+ if (e != nullptr && (e->kind == Entity_Procedure || e->kind == Entity_ProcGroup) && selector->kind == Ast_Ident) {
+ gbString sel_str = expr_to_string(selector);
+ error(node, "'%s' is not declared by by '%.*s'", sel_str, LIT(e->token.string));
+ gb_string_free(sel_str);
+ operand->mode = Addressing_Invalid;
+ operand->expr = node;
+ return nullptr;
+ } else if (e != nullptr && e->kind == Entity_ImportName && selector->kind == Ast_Ident) {
// IMPORTANT NOTE(bill): This is very sloppy code but it's also very fragile
// It pretty much needs to be in this order and this way
// If you can clean this up, please do but be really careful