diff options
-rw-r--r-- | src/library/scala/collection/generic/MutableSetTemplate.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/HashSet.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t2183.scala | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/library/scala/collection/generic/MutableSetTemplate.scala b/src/library/scala/collection/generic/MutableSetTemplate.scala index 1f29838174..d79c737e66 100644 --- a/src/library/scala/collection/generic/MutableSetTemplate.scala +++ b/src/library/scala/collection/generic/MutableSetTemplate.scala @@ -41,7 +41,7 @@ trait MutableSetTemplate[A, +This <: MutableSetTemplate[A, This] with mutable.Se with Builder[A, This] with Growable[A] with Shrinkable[A] - with Cloneable[This] + with Cloneable[mutable.Set[A]] { self => /** A common implementation of <code>newBuilder</code> for all mutable sets @@ -103,7 +103,7 @@ trait MutableSetTemplate[A, +This <: MutableSetTemplate[A, This] with mutable.Se */ def clear() { foreach(-=) } - override def clone(): This = empty ++= thisCollection + override def clone(): mutable.Set[A] = empty ++= thisCollection def result: This = thisCollection diff --git a/src/library/scala/collection/mutable/HashSet.scala b/src/library/scala/collection/mutable/HashSet.scala index 12b7398db1..b150c75773 100644 --- a/src/library/scala/collection/mutable/HashSet.scala +++ b/src/library/scala/collection/mutable/HashSet.scala @@ -48,7 +48,7 @@ class HashSet[A] extends Set[A] } } - override def clone(): HashSet[A] = new HashSet[A] ++= this + override def clone(): Set[A] = new HashSet[A] ++= this } /** Factory object for `HashSet` class */ diff --git a/test/files/pos/t2183.scala b/test/files/pos/t2183.scala new file mode 100644 index 0000000000..1243568b63 --- /dev/null +++ b/test/files/pos/t2183.scala @@ -0,0 +1,5 @@ +import scala.collection.mutable._ + +object Test { + val m = new HashSet[String] with SynchronizedSet[String] +} |