diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-11 14:40:27 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-11 14:40:27 +0100 |
| commit | c4c6975f1b36eb4848aacf81c7be3584c51f9ab6 (patch) | |
| tree | a73b5401f45e8ffb47ebc3fe64281d7080ab7195 /src/check_decl.cpp | |
| parent | 0be0fb2a57e997d4e7efd7b42f7fe1a1b35c80e5 (diff) | |
`cast(Type)expr`; Fix overloaded procedure determination on assignment
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)) { |