summaryrefslogtreecommitdiff
path: root/test/files/run/t7498.scala
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2013-05-30 14:37:01 +0200
committerAleksandar Prokopec <axel22@gmail.com>2013-05-30 18:24:10 +0200
commitfcec27575659b75275b38687e81cb677b0a452aa (patch)
tree5203ac3bff894a138c3aec752379bb58eedc7a13 /test/files/run/t7498.scala
parent1c6a0cf75592c201e27a6e11140c6da87de67123 (diff)
downloadscala-fcec27575659b75275b38687e81cb677b0a452aa.tar.gz
scala-fcec27575659b75275b38687e81cb677b0a452aa.tar.bz2
scala-fcec27575659b75275b38687e81cb677b0a452aa.zip
SI-7498 ParTrieMap.foreach no longer crashes
Previously, the `split` method of the `ParTrieMap` iterator threw an exception when splitting a splitter that iterated over nodes whose hash codes collide. This was due to reusing the iterator of the list of colliding keys rather than creating a new splitter. This commit changes the `subdivide` method to create a new iterator using the factory method of the current trie map iterator rather than returning a `LinearSeqLike` iterator.
Diffstat (limited to 'test/files/run/t7498.scala')
-rw-r--r--test/files/run/t7498.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t7498.scala b/test/files/run/t7498.scala
new file mode 100644
index 0000000000..1dbf0597e0
--- /dev/null
+++ b/test/files/run/t7498.scala
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+object Test extends App {
+ import scala.collection.concurrent.TrieMap
+
+ class Collision(val idx: Int) {
+ override def hashCode = idx % 10
+ }
+
+ val tm = TrieMap[Collision, Unit]()
+ for (i <- 0 until 1000) tm(new Collision(i)) = ()
+
+ tm.par.foreach(kv => ())
+}
+