aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-07-29 02:21:26 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-07-29 02:32:13 +0200
commit4d1d754caeb421da9a289fee613aea16867f14ce (patch)
tree61844c9acfd42ce0c72b0b8f0b26b61eba7b7a03 /tests
parent24e6f16f4aa574b182e4ec2361b22b4c3d71e34c (diff)
fix `specific_union_variant in map_keyed_by_union` not converting to union type
Diffstat (limited to 'tests')
-rw-r--r--tests/internal/test_map.odin20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/internal/test_map.odin b/tests/internal/test_map.odin
index 9bd5d34ea..4d305024e 100644
--- a/tests/internal/test_map.odin
+++ b/tests/internal/test_map.odin
@@ -317,3 +317,23 @@ set_delete_random_key_value :: proc(t: ^testing.T) {
seed_incr += 1
}
}
+
+@test
+test_union_key_should_not_be_hashing_specifc_variant :: proc(t: ^testing.T) {
+ Vec2 :: [2]f32
+ BoneId :: distinct int
+ VertexId :: distinct int
+ Id :: union {
+ BoneId,
+ VertexId,
+ }
+
+ m: map[Id]Vec2
+ defer delete(m)
+
+ bone_1: BoneId = 69
+ m[bone_1] = {4, 20}
+
+ testing.expect_value(t, bone_1 in m, true)
+ testing.expect_value(t, Id(bone_1) in m, true)
+}