1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix alias of map delete (#15644)

This commit is contained in:
yuyi
2022-09-03 15:41:53 +08:00
committed by GitHub
parent 1ef95fdec6
commit a5aad6f791
2 changed files with 15 additions and 2 deletions

View File

@ -980,3 +980,16 @@ fn test_map_set_fixed_array_variable() {
println(m2)
assert '$m2' == "{'A': [1.1, 2.2]}"
}
type Map = map[int]int
fn test_alias_of_map_delete() {
mut m := Map(map[int]int{})
m[11] = 111
m[22] = 222
println(m)
m.delete(11)
println(m)
assert m.len == 1
assert m[22] == 222
}