New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference issue on Set.subsets methods #9116
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9116?orig=1 |
@som-snytt said: Or anything that anything that induces type inference. Such as using I think it's sufficient if the parameterless Alternatively, or until then, Welcome to Scala version 2.11.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala> implicit class ss[A](val s: Set[A]) { def ss(n: Int) = s subsets n ; def ss = s.subsets }
defined class ss
scala> List(1, 2, 3).toSet.subsets.map(_.toList)
<console>:9: error: missing parameter type for expanded function ((x$1) => x$1.toList)
List(1, 2, 3).toSet.subsets.map(_.toList)
^
scala> List(1, 2, 3).toSet.ss.map(_.toList)
res1: Iterator[List[Int]] = non-empty iterator |
@som-snytt said: |
@adriaanm said: |
Christopher Vogt (cvogt) said: |
The problem is best illustrated in the REPL:
Note that doing this with Set(1, 2, 3) directly does not produce the issue.
Both Set.subsets and Set.subsets(Int) have the same return type so I don't see why the latter line should not compile.
Originally, I asked this as a question on Stack Overflow
The text was updated successfully, but these errors were encountered: