aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-11 20:54:38 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-11 20:54:38 +0100
commitb5587f1937edf8440fdf713988c9e3bc38886e93 (patch)
tree2754c99d10177758d0d47228d44215b96081697d /src/check_expr.cpp
parentc4c6975f1b36eb4848aacf81c7be3584c51f9ab6 (diff)
Fix aliasing of overloaded procedures from other scopes
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 215299f96..ba182db3f 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -4081,6 +4081,13 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
String op_name = op_expr->Ident.token.string;
Entity *e = scope_lookup_entity(c->context.scope, op_name);
+ bool is_alias = false;
+ while (e->kind == Entity_Alias) {
+ GB_ASSERT(e->Alias.base != nullptr);
+ e = e->Alias.base;
+ is_alias = true;
+ }
+
add_entity_use(c, op_expr, e);
expr_entity = e;
@@ -4111,9 +4118,24 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
operand->expr = node;
return nullptr;
}
+
+
+ bool is_alias = false;
+ while (entity->kind == Entity_Alias) {
+ GB_ASSERT(e->Alias.base != nullptr);
+ entity = entity->Alias.base;
+ is_alias = true;
+ }
+
check_entity_decl(c, entity, nullptr, nullptr);
GB_ASSERT(entity->type != nullptr);
+ if (is_alias) {
+ // TODO(bill): Which scope do you search for for an alias?
+ // import_scope = entity->scope;
+ entity_name = entity->token.string;
+ }
+
isize overload_count = entity_overload_count(import_scope, entity_name);
bool is_overloaded = overload_count > 1;