diff options
| author | gingerBill <bill@gingerbill.org> | 2021-08-13 11:49:52 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-08-13 11:49:52 +0100 |
| commit | 8ff9f2e44f6a92ae5429bac257b4fb94829e9fd3 (patch) | |
| tree | ae918ea3dcfa22a47b95e45ebf1a463557e7bb92 /src/check_type.cpp | |
| parent | 799a56bbcb5146697ce01442b190fabc07b6dc0b (diff) | |
Fix #1077
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 4822b3f0d..a1b446ad2 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -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)); 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) { Entity *e = (*found_gen_types)[i]; Type *t = base_type(e->type); @@ -249,13 +251,14 @@ Entity *find_polymorphic_record_entity(CheckerContext *ctx, Type *original_type, bool skip = false; - GB_ASSERT(ordered_operands.count >= param_count); - for (isize j = 0; j < param_count; 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) { - return nullptr; + continue; } Entity *oe = entity_of_node(o.expr); if (p == oe) { |