summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/collection/immutable/HashSet.scala4
-rw-r--r--test/files/run/bug3984.scala21
2 files changed, 23 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala
index 7d27531e8d..5a65e69d4d 100644
--- a/src/library/scala/collection/immutable/HashSet.scala
+++ b/src/library/scala/collection/immutable/HashSet.scala
@@ -301,7 +301,7 @@ time { mNew.iterator.foreach( p => ()) }
}
@scala.annotation.tailrec private[this] def next0(elems: Array[HashSet[A]], i: Int): A = {
- if (i == elems.length-1) { // reached end of level, pop stack
+ if (i == elems.length - 1) { // reached end of level, pop stack
depth -= 1
if (depth >= 0) {
arrayD = arrayStack(depth)
@@ -327,7 +327,7 @@ time { mNew.iterator.foreach( p => ()) }
case m: HashSet1[A] => m.key
case m =>
subIter = m.iterator
- subIter.next
+ next
}
}
diff --git a/test/files/run/bug3984.scala b/test/files/run/bug3984.scala
new file mode 100644
index 0000000000..3e4d2edf53
--- /dev/null
+++ b/test/files/run/bug3984.scala
@@ -0,0 +1,21 @@
+object Test {
+ import scala.collection.immutable.{ Set => ImmutSet }
+ import scala.collection.mutable.{ Set => MutSet }
+
+ case class IH (i: Int, h: Int) {
+ override def hashCode: Int = h
+ }
+
+ def main (args: Array[String]) {
+ var is = ImmutSet.empty[IH]
+ var ms = MutSet.empty[IH]
+ for (ih <- List(IH(2,0),IH(0,0),IH(4,4),IH(6,4),IH(-8,1520786080))) {
+ is = is + ih
+ ms = ms + ih
+ }
+ val x = IH(6,4)
+ is = is - x
+ ms = ms - x
+ assert(is == ms)
+ }
+}