fix specific_union_variant in map_keyed_by_union not converting to union type

This commit is contained in:
Laytan Laats
2024-07-29 02:21:26 +02:00
parent 24e6f16f4a
commit 4d1d754cae
2 changed files with 26 additions and 4 deletions

View File

@@ -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)
}