mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Fix Internal error when accessing polymorphic struct parameters (also provide suggestions?) #513
This commit is contained in:
+12
-1
@@ -3254,7 +3254,18 @@ Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *typ
|
|||||||
return nullptr;
|
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);
|
add_entity_use(c, selector, entity);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user