diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-10-26 14:18:45 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-10-26 14:18:45 +0000 |
commit | dc11fa1ca6b0710c55f8ba75204325e045ac0094 (patch) | |
tree | c76f608f9aba333f5376eab3a31a0f9bde45e317 | |
parent | 0895da3b109e150acf511bb09e23d404c3df8974 (diff) | |
download | scala-dc11fa1ca6b0710c55f8ba75204325e045ac0094.tar.gz scala-dc11fa1ca6b0710c55f8ba75204325e045ac0094.tar.bz2 scala-dc11fa1ca6b0710c55f8ba75204325e045ac0094.zip |
close #3954, no review
-rw-r--r-- | src/library/scala/collection/mutable/SetLike.scala | 2 | ||||
-rw-r--r-- | test/files/run/colltest.check | 6 | ||||
-rw-r--r-- | test/files/run/colltest.scala | 15 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/library/scala/collection/mutable/SetLike.scala b/src/library/scala/collection/mutable/SetLike.scala index 39ab1ff634..6264d1fbc2 100644 --- a/src/library/scala/collection/mutable/SetLike.scala +++ b/src/library/scala/collection/mutable/SetLike.scala @@ -79,7 +79,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] def add(elem: A): Boolean = { val r = contains(elem) this += elem - r + !r } /** Removes an element from this set. diff --git a/test/files/run/colltest.check b/test/files/run/colltest.check index be930f06ce..1ad81a1350 100644 --- a/test/files/run/colltest.check +++ b/test/files/run/colltest.check @@ -1 +1,7 @@ +true +false +true +false +true +false succeeded for 10 iterations. diff --git a/test/files/run/colltest.scala b/test/files/run/colltest.scala index b6577006f4..b635c4e531 100644 --- a/test/files/run/colltest.scala +++ b/test/files/run/colltest.scala @@ -46,5 +46,20 @@ class TestSet(s0: Set[Int], s1: Set[Int]) { Console.println("succeeded for "+Iterations+" iterations.") } object Test extends Application { + def t3954 { + import scala.collection.mutable + import scala.collection.immutable + val result = new mutable.ImmutableSetAdaptor(immutable.ListSet.empty[Int]) + println(result.add(1)) + println(result.add(1)) + val result2 = new mutable.HashSet[Int] + println(result2.add(1)) + println(result2.add(1)) + val result3 = new java.util.HashSet[Int]() + println(result3.add(1)) + println(result3.add(1)) + } + t3954 + new TestSet(HashSet.empty, new scala.collection.mutable.LinkedHashSet) } |