diff options
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 0ee604283..4e3df54c1 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3254,7 +3254,18 @@ Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *typ return nullptr; } - + if (expr_entity != nullptr && is_type_polymorphic(expr_entity->type)) { + gbString op_str = expr_to_string(op_expr); + gbString type_str = type_to_string(operand->type); + gbString sel_str = expr_to_string(selector); + error(op_expr, "Cannot access field '%s' from non-specialized polymorphic type '%s'", sel_str, op_str); + gb_string_free(sel_str); + gb_string_free(type_str); + gb_string_free(op_str); + operand->mode = Addressing_Invalid; + operand->expr = node; + return nullptr; + } add_entity_use(c, selector, entity); |