diff options
author | Martin Odersky <odersky@gmail.com> | 2009-10-02 17:57:16 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-10-02 17:57:16 +0000 |
commit | 83b67aa805fd1329d6bcc54b1c1fa16416437b6f (patch) | |
tree | 3fcc59ba0523f644bceef4676f7a6689f9949417 /test/pending/neg/t2180.scala | |
parent | 84146e2f53fb1f5e8abbc521121078e932cf82e7 (diff) | |
download | scala-83b67aa805fd1329d6bcc54b1c1fa16416437b6f.tar.gz scala-83b67aa805fd1329d6bcc54b1c1fa16416437b6f.tar.bz2 scala-83b67aa805fd1329d6bcc54b1c1fa16416437b6f.zip |
Sequence->Seq
Diffstat (limited to 'test/pending/neg/t2180.scala')
-rw-r--r-- | test/pending/neg/t2180.scala | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/pending/neg/t2180.scala b/test/pending/neg/t2180.scala new file mode 100644 index 0000000000..a8055bf77d --- /dev/null +++ b/test/pending/neg/t2180.scala @@ -0,0 +1,31 @@ + + +Given the following code (which is broken): + +class Mxml { + + private def processChildren( children:Seq[Any] ):List[Mxml] = { + + children.toList.flatMap ( e => { + + e match { + + case s:scala.collection.Traversable[_] => s case a => List(a) + + } + + }) + + } + +} + +I get the following error: + +Mxml.scala:5: error: could not find implicit value for parameter bf:scala.collection.generic.BuilderFactory[Any,List[Mxml],Sequence[Any]]. + + children.flatMap ( e => { + +I spent 4 hours failing before I figured out the problem. The return type was wrong. It should have been List[Any]. + +I have seen similar errors with map. My solution in the past has been to change it to a foldLeft because I have never been able to determine how to fix the problem until now. |