mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-22 21:54:59 -07:00
Fix #3555
This commit is contained in:
@@ -1619,6 +1619,17 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
|
||||
if (e->kind != Entity_Variable) {
|
||||
continue;
|
||||
}
|
||||
if (is_type_polymorphic(e->type)) {
|
||||
gbString s = type_to_string(e->type);
|
||||
char const *msg = "Unspecialized polymorphic types are not allowed in procedure parameters, got %s";
|
||||
if (e->Variable.type_expr) {
|
||||
error(e->Variable.type_expr, msg, s);
|
||||
} else {
|
||||
error(e->token, msg, s);
|
||||
}
|
||||
gb_string_free(s);
|
||||
}
|
||||
|
||||
if (!(e->flags & EntityFlag_Using)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2076,6 +2076,7 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
|
||||
param = alloc_entity_param(scope, name->Ident.token, type, is_using, true);
|
||||
param->Variable.param_value = param_value;
|
||||
param->Variable.field_group_index = field_group_index;
|
||||
param->Variable.type_expr = type_expr;
|
||||
}
|
||||
}
|
||||
if (p->flags&FieldFlag_no_alias) {
|
||||
|
||||
@@ -210,6 +210,7 @@ struct Entity {
|
||||
CommentGroup *comment;
|
||||
} Constant;
|
||||
struct {
|
||||
Ast *type_expr; // only used for some variables within procedure bodies
|
||||
Ast *init_expr; // only used for some variables within procedure bodies
|
||||
i32 field_index;
|
||||
i32 field_group_index;
|
||||
|
||||
@@ -3267,6 +3267,10 @@ gb_internal Selection lookup_field_with_selection(Type *type_, String field_name
|
||||
}
|
||||
}
|
||||
|
||||
if (is_type_polymorphic(type)) {
|
||||
// NOTE(bill): A polymorphic struct has no fields, this only hits in the case of an error
|
||||
return sel;
|
||||
}
|
||||
wait_signal_until_available(&type->Struct.fields_wait_signal);
|
||||
isize field_count = type->Struct.fields.count;
|
||||
if (field_count != 0) for_array(i, type->Struct.fields) {
|
||||
|
||||
Reference in New Issue
Block a user