mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00: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) {
|
if (e->kind != Entity_Variable) {
|
||||||
continue;
|
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)) {
|
if (!(e->flags & EntityFlag_Using)) {
|
||||||
continue;
|
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 = alloc_entity_param(scope, name->Ident.token, type, is_using, true);
|
||||||
param->Variable.param_value = param_value;
|
param->Variable.param_value = param_value;
|
||||||
param->Variable.field_group_index = field_group_index;
|
param->Variable.field_group_index = field_group_index;
|
||||||
|
param->Variable.type_expr = type_expr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p->flags&FieldFlag_no_alias) {
|
if (p->flags&FieldFlag_no_alias) {
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ struct Entity {
|
|||||||
CommentGroup *comment;
|
CommentGroup *comment;
|
||||||
} Constant;
|
} Constant;
|
||||||
struct {
|
struct {
|
||||||
|
Ast *type_expr; // only used for some variables within procedure bodies
|
||||||
Ast *init_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_index;
|
||||||
i32 field_group_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);
|
wait_signal_until_available(&type->Struct.fields_wait_signal);
|
||||||
isize field_count = type->Struct.fields.count;
|
isize field_count = type->Struct.fields.count;
|
||||||
if (field_count != 0) for_array(i, type->Struct.fields) {
|
if (field_count != 0) for_array(i, type->Struct.fields) {
|
||||||
|
|||||||
Reference in New Issue
Block a user