Closed Angluca closed 3 months ago
import std::compact_map::Map // ------ let map = Map<u32, str>::new(); map.insert(1, "111") map.insert(2, "222") assert map[1] == "111" assert map.contains(2) map.remove(1) for val: map.iter() { println(`{val.key}:{val.value}`) } assert map.contains(2) println(`{map[2]}`)
|| 2:222 || -------------------------------------------------------------------------------- || ... : Assertion failed: `map.contains(2)` || -- and -- || ... map[2]: compact_map.oc:154:16: Assertion failed: `false` Message: Key not found in Map::at() || -------------------------------------------------------------------------------- || [Finished in 0 seconds with code -1]
remove(1) after can print 2:"222", but contain(2) and map[2] all failed
I've test insert and get_item, get_index(2, 15634) not the same last
|| insert: K:1,hash:7817,idx:9 || insert: K:2,hash:15634,idx:2 || get_index: K:1, hash:7817, indices:0 || get_item: K:1,hash:7817,idx:9 || get_index: K:2, hash:15634, indices:1 || get_index: K:1, hash:7817, indices:0 || get_index: K:2, hash:15634, indices:1 || 2:222 || get_index: K:2, hash:15634, indices:9 || get_item: K:2,hash:15634,idx:13
typo on my end that never got caught 😅 Thanks for the bug report!
remove(1) after can print 2:"222", but contain(2) and map[2] all failed
I've test insert and get_item, get_index(2, 15634) not the same last