|
@@ -5286,8 +5286,8 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
|
TypeTuple *tuple = get_record_polymorphic_params(original_type);
|
|
TypeTuple *tuple = get_record_polymorphic_params(original_type);
|
|
isize param_count = tuple->variables.count;
|
|
isize param_count = tuple->variables.count;
|
|
isize minimum_param_count = param_count;
|
|
isize minimum_param_count = param_count;
|
|
- for (minimum_param_count = tuple->variables.count-1; minimum_param_count >= 0; minimum_param_count--) {
|
|
|
|
- Entity *e = tuple->variables[minimum_param_count];
|
|
|
|
|
|
+ for (; minimum_param_count > 0; minimum_param_count--) {
|
|
|
|
+ Entity *e = tuple->variables[minimum_param_count-1];
|
|
if (e->kind != Entity_Constant) {
|
|
if (e->kind != Entity_Constant) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -5296,6 +5296,7 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
Array<Operand> ordered_operands = operands;
|
|
Array<Operand> ordered_operands = operands;
|
|
if (!named_fields) {
|
|
if (!named_fields) {
|
|
ordered_operands = array_make<Operand>(permanent_allocator(), param_count);
|
|
ordered_operands = array_make<Operand>(permanent_allocator(), param_count);
|
|
@@ -5367,6 +5368,13 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ while (ordered_operands.count >= 0) {
|
|
|
|
+ if (ordered_operands[ordered_operands.count-1].expr != nullptr) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ array_pop(&ordered_operands);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (minimum_param_count != param_count) {
|
|
if (minimum_param_count != param_count) {
|
|
if (param_count < ordered_operands.count) {
|
|
if (param_count < ordered_operands.count) {
|
|
error(call, "Too many polymorphic type arguments, expected a maximum of %td, got %td", param_count, ordered_operands.count);
|
|
error(call, "Too many polymorphic type arguments, expected a maximum of %td, got %td", param_count, ordered_operands.count);
|