diff options
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. |