diff options
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 1ce518318..52f785ef6 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -23,13 +23,27 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex } + if (operand->mode == Addressing_Overload) { + if (e->type == nullptr) { + error(operand->expr, "Cannot determine type from overloaded procedure `%.*s`", LIT(operand->overload_entities[0]->token.string)); + } else { + check_assignment(c, operand, e->type, str_lit("variable assignment")); + if (operand->mode != Addressing_Type) { + return operand->type; + } + } + } + if (e->type == nullptr) { e->type = t_invalid; } return nullptr; } + + if (e->type == nullptr) { + // NOTE(bill): Use the type of the operand Type *t = operand->type; if (is_type_untyped(t)) { |