summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-01-26 22:35:44 -0800
committerSom Snytt <som.snytt@gmail.com>2015-02-09 23:21:03 -0800
commit5412766a834fa730865628a57c767f36eb1b4dc4 (patch)
tree4f57053efd4efe636d4443db40e91ad2fbf0dc72
parent41cee92bb516c6a9679773ebae88230c30ac67bd (diff)
downloadscala-5412766a834fa730865628a57c767f36eb1b4dc4.tar.gz
scala-5412766a834fa730865628a57c767f36eb1b4dc4.tar.bz2
scala-5412766a834fa730865628a57c767f36eb1b4dc4.zip
SI-9116 Set.subsets has a param list
Now both of the overloaded variants have a parameter list. This seems to make type inference happier. Or it makes someone happier. The user is unaware whether `subsets()` takes a default arg. But happily, empty application still kicks in.
-rw-r--r--src/library/scala/collection/SetLike.scala2
-rw-r--r--test/files/pos/t9116.scala7
-rw-r--r--test/files/run/settings-parse.scala5
3 files changed, 10 insertions, 4 deletions
diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala
index 3e549f72cd..31465bb619 100644
--- a/src/library/scala/collection/SetLike.scala
+++ b/src/library/scala/collection/SetLike.scala
@@ -171,7 +171,7 @@ self =>
*
* @return the iterator.
*/
- def subsets: Iterator[This] = new AbstractIterator[This] {
+ def subsets(): Iterator[This] = new AbstractIterator[This] {
private val elms = self.toIndexedSeq
private var len = 0
private var itr: Iterator[This] = Iterator.empty
diff --git a/test/files/pos/t9116.scala b/test/files/pos/t9116.scala
new file mode 100644
index 0000000000..16b04c2e6b
--- /dev/null
+++ b/test/files/pos/t9116.scala
@@ -0,0 +1,7 @@
+
+trait X {
+ List(1, 2, 3).toSet.subsets.map(_.toList) // ok now
+
+ List(1, 2, 3).toSet.subsets().map(_.toList) // now also
+ List(1, 2, 3).toSet.subsets(2).map(_.toList) // still ok
+}
diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala
index 2754feb972..8d83caf68f 100644
--- a/test/files/run/settings-parse.scala
+++ b/test/files/run/settings-parse.scala
@@ -3,9 +3,8 @@ import scala.language.postfixOps
import scala.tools.nsc._
object Test {
- val tokens = List("", "-deprecation", "foo.scala")
- val subsets = tokens.toSet.subsets.toList
- val permutations0 = subsets.flatMap(_.toList.permutations).distinct
+ val tokens = "" :: "-deprecation" :: "foo.scala" :: Nil
+ val permutations0 = tokens.toSet.subsets.flatMap(_.toList.permutations).toList.distinct
def runWithCp(cp: String) = {
val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations)