Recently I got an odd error in Swift 1.2 while using closures.
As you can see in the gist below there is an error; the closure(transformedNoReturn) fails to return a value even though the return type of the closure is U?. Now if the closure is empty(case transformedEmptyClosure below) then we get the useful error Missing return in a closure expected to return ‘Int?’. But if the closure has statements in it but fails to return(case transformedNoReturn) we get the above error ‘filterMap’ with an argument list of type ‘((String) -> Int?)’ even though the error has nothing to do with the argument type.
I’ve filed a radar on this rdar://20962906
UPDATE : This appears to be fixed in Xcode 7.1 beta 2.