diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-03-13 12:23:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 12:23:19 +0000 |
| commit | 5c1646a6b3b9c721a095ea3e160ece9138126faf (patch) | |
| tree | f09e37527261a04d31bb11431025112ae426aff5 /src/check_expr.cpp | |
| parent | 23f3898b4efdc3003f8b89d64fcadd638b852bd9 (diff) | |
| parent | 7bc962b852e9e4ad0a8619f7265192f528cbe0be (diff) | |
Merge pull request #3271 from rick-masters/too_many_poly_args
Fix check for too many arguments to a polymorphic record type
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 0911e48cf..1e4c7499b 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6796,7 +6796,7 @@ gb_internal CallArgumentError check_polymorphic_record_type(CheckerContext *c, O isize index = lookup_polymorphic_record_parameter(original_type, name); if (index >= 0) { TypeTuple *params = get_record_polymorphic_params(original_type); - Entity *e = params->variables[i]; + Entity *e = params->variables[index]; if (e->kind == Entity_Constant) { check_expr_with_type_hint(c, &operands[i], fv->value, e->type); continue; @@ -6847,7 +6847,7 @@ gb_internal CallArgumentError check_polymorphic_record_type(CheckerContext *c, O Array<Operand> ordered_operands = operands; if (!named_fields) { - ordered_operands = array_make<Operand>(permanent_allocator(), param_count); + ordered_operands = array_make<Operand>(permanent_allocator(), operands.count); array_copy(&ordered_operands, operands, 0); } else { TEMPORARY_ALLOCATOR_GUARD(); |