diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-12 00:18:58 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-12 00:18:58 +0000 |
| commit | 5fa66ac6a8d8624fdb078d459ff58c45fa2dae9a (patch) | |
| tree | 47ec2d9d138628373db7ff4d7ed683273168ae81 /src | |
| parent | 320062157f06d979db926fcbf407bbbdcc3028c1 (diff) | |
Fix random race condition for poly records
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_type.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 0863af967..c536bf09f 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -272,7 +272,20 @@ gb_internal Entity *find_polymorphic_record_entity(CheckerContext *ctx, Type *or for (Entity *e : found_gen_types->types) { Type *t = base_type(e->type); - TypeTuple *tuple = get_record_polymorphic_params(t); + TypeTuple *tuple = nullptr; + switch (t->kind) { + case Type_Struct: + if (t->Struct.polymorphic_params) { + tuple = &t->Struct.polymorphic_params->Tuple; + } + break; + case Type_Union: + if (t->Union.polymorphic_params) { + tuple = &t->Union.polymorphic_params->Tuple; + } + break; + } + GB_ASSERT_MSG(tuple != nullptr, "%s :: %s", type_to_string(e->type), type_to_string(t)); GB_ASSERT(param_count == tuple->variables.count); bool skip = false; |