Affects Version/s: Scala 2.9.2
Fix Version/s: Scala 2.10.0-M3
Windows 7, 64bit
The merge function of scala.collections.immutable.HashMap can result in an inconsistent HashMap when there is a hash code collision. The easiest way to get this behavior is to merge two maps and defining a collision function.
But this also occasionally happens when no collision function is provided!
HashMap1 caches both the value and a key/value pair. As a result of the merge the value field is inconsistent to the kv field. When printing the map, the kv field is used, so the result is correct. When calling apply, the value field is used, and the result is wrong.
HashMap1.value and HashMap1.kv should never be able to become inconsistent. To fix this in HashMap1.updated0:
But there might be other places where this issue (inconsistency between kv and value) occurs.