mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-05 04:27:51 +00:00
Fix polymorphic record "too few" lacking error message
This commit is contained in:
@@ -5286,8 +5286,8 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
||||
TypeTuple *tuple = get_record_polymorphic_params(original_type);
|
||||
isize param_count = tuple->variables.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) {
|
||||
break;
|
||||
}
|
||||
@@ -5296,6 +5296,7 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Array<Operand> ordered_operands = operands;
|
||||
if (!named_fields) {
|
||||
ordered_operands = array_make<Operand>(permanent_allocator(), param_count);
|
||||
@@ -5367,6 +5368,13 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
|
||||
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 (param_count < ordered_operands.count) {
|
||||
error(call, "Too many polymorphic type arguments, expected a maximum of %td, got %td", param_count, ordered_operands.count);
|
||||
|
||||
Reference in New Issue
Block a user