diff options
| author | Laytan <laytanlaats@hotmail.com> | 2024-07-29 02:39:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-29 02:39:47 +0200 |
| commit | 7f17d4eb7fa0b95dfed3a42211d9188479bfd820 (patch) | |
| tree | 61844c9acfd42ce0c72b0b8f0b26b61eba7b7a03 /src | |
| parent | 24e6f16f4aa574b182e4ec2361b22b4c3d71e34c (diff) | |
| parent | 4d1d754caeb421da9a289fee613aea16867f14ce (diff) | |
Merge pull request #3991 from laytan/fix-in-map-with-union-variants
fix `specific_union_variant in map_keyed_by_union` not converting to union type
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 9fa570eaf..72ba12516 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -976,14 +976,16 @@ gb_internal lbValue lb_const_hash(lbModule *m, lbValue key, Type *key_type) { gb_internal lbValue lb_gen_map_key_hash(lbProcedure *p, lbValue const &map_ptr, lbValue key, lbValue *key_ptr_) { TEMPORARY_ALLOCATOR_GUARD(); - lbValue key_ptr = lb_address_from_load_or_generate_local(p, key); + Type* key_type = base_type(type_deref(map_ptr.type))->Map.key; + + lbValue real_key = lb_emit_conv(p, key, key_type); + + lbValue key_ptr = lb_address_from_load_or_generate_local(p, real_key); key_ptr = lb_emit_conv(p, key_ptr, t_rawptr); if (key_ptr_) *key_ptr_ = key_ptr; - Type* key_type = base_type(type_deref(map_ptr.type))->Map.key; - - lbValue hashed_key = lb_const_hash(p->module, key, key_type); + lbValue hashed_key = lb_const_hash(p->module, real_key, key_type); if (hashed_key.value == nullptr) { lbValue hasher = lb_hasher_proc_for_type(p->module, key_type); |