It seems that the compiler fails to infer the type of an anonymous function
if the function contains more than one statement. For example, this works:
let a = [[1,2],[3],[4,5,6]]
var b: [Int]
b = a.flatMap { elem in
return elem
}
But this fails with an error "cannot convert return expression of
ed anything here -- this is my
recollection of listening in on various discussions in the past).
> On Jul 8, 2016, at 10:00 AM, Ross LeBeau via swift-dev <
swift-dev@swift.org> wrote:
>
> It seems that the compiler fails to infer the type of an anonymous
function if the function contains mor
Filed here: https://bugs.swift.org/browse/SR-2033
Thanks for the help! Cool to learn a new thing about Swift today :)
--
Ross LeBeau
On July 8, 2016 at 2:57:55 PM, Slava Pestov (spes...@apple.com) wrote:
"Did not infer types, try explicitly declaring them"
_