mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Fix #1077
This commit is contained in:
@@ -5599,6 +5599,8 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (minimum_param_count != param_count) {
|
if (minimum_param_count != param_count) {
|
||||||
|
array_resize(&ordered_operands, param_count);
|
||||||
|
|
||||||
isize missing_count = 0;
|
isize missing_count = 0;
|
||||||
// NOTE(bill): Replace missing operands with the default values (if possible)
|
// NOTE(bill): Replace missing operands with the default values (if possible)
|
||||||
for_array(i, ordered_operands) {
|
for_array(i, ordered_operands) {
|
||||||
@@ -5613,6 +5615,11 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
|||||||
if (e->Constant.param_value.kind == ParameterValue_Constant) {
|
if (e->Constant.param_value.kind == ParameterValue_Constant) {
|
||||||
o->value = e->Constant.param_value.value;
|
o->value = e->Constant.param_value.value;
|
||||||
}
|
}
|
||||||
|
} else if (e->kind == Entity_TypeName) {
|
||||||
|
missing_count += 1;
|
||||||
|
o->mode = Addressing_Type;
|
||||||
|
o->type = e->type;
|
||||||
|
o->expr = e->identifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-4
@@ -241,6 +241,8 @@ Entity *find_polymorphic_record_entity(CheckerContext *ctx, Type *original_type,
|
|||||||
|
|
||||||
auto *found_gen_types = map_get(&ctx->info->gen_types, hash_pointer(original_type));
|
auto *found_gen_types = map_get(&ctx->info->gen_types, hash_pointer(original_type));
|
||||||
if (found_gen_types != nullptr) {
|
if (found_gen_types != nullptr) {
|
||||||
|
// GB_ASSERT_MSG(ordered_operands.count >= param_count, "%td >= %td", ordered_operands.count, param_count);
|
||||||
|
|
||||||
for_array(i, *found_gen_types) {
|
for_array(i, *found_gen_types) {
|
||||||
Entity *e = (*found_gen_types)[i];
|
Entity *e = (*found_gen_types)[i];
|
||||||
Type *t = base_type(e->type);
|
Type *t = base_type(e->type);
|
||||||
@@ -249,13 +251,14 @@ Entity *find_polymorphic_record_entity(CheckerContext *ctx, Type *original_type,
|
|||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
GB_ASSERT(ordered_operands.count >= param_count);
|
|
||||||
|
|
||||||
for (isize j = 0; j < param_count; j++) {
|
for (isize j = 0; j < param_count; j++) {
|
||||||
Entity *p = tuple->variables[j];
|
Entity *p = tuple->variables[j];
|
||||||
Operand o = ordered_operands[j];
|
Operand o = {};
|
||||||
|
if (j < ordered_operands.count) {
|
||||||
|
o = ordered_operands[j];
|
||||||
|
}
|
||||||
if (o.expr == nullptr) {
|
if (o.expr == nullptr) {
|
||||||
return nullptr;
|
continue;
|
||||||
}
|
}
|
||||||
Entity *oe = entity_of_node(o.expr);
|
Entity *oe = entity_of_node(o.expr);
|
||||||
if (p == oe) {
|
if (p == oe) {
|
||||||
|
|||||||
@@ -2021,7 +2021,7 @@ lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
|
|||||||
for_array(i, ce->args) {
|
for_array(i, ce->args) {
|
||||||
Ast *arg = ce->args[i];
|
Ast *arg = ce->args[i];
|
||||||
TypeAndValue tav = type_and_value_of_expr(arg);
|
TypeAndValue tav = type_and_value_of_expr(arg);
|
||||||
GB_ASSERT_MSG(tav.mode != Addressing_Invalid, "%s %s", expr_to_string(arg), expr_to_string(expr));
|
GB_ASSERT_MSG(tav.mode != Addressing_Invalid, "%s %s %d", expr_to_string(arg), expr_to_string(expr), tav.mode);
|
||||||
GB_ASSERT_MSG(tav.mode != Addressing_ProcGroup, "%s", expr_to_string(arg));
|
GB_ASSERT_MSG(tav.mode != Addressing_ProcGroup, "%s", expr_to_string(arg));
|
||||||
Type *at = tav.type;
|
Type *at = tav.type;
|
||||||
if (at->kind == Type_Tuple) {
|
if (at->kind == Type_Tuple) {
|
||||||
|
|||||||
Reference in New Issue
Block a user