Confusing error message for closures that do not return value

Number:rdar://20962906 Date Originated:14-May-2015 02:40 PM
Status:Open Resolved:Fixed in Xcode 7.1 beta 2
Product:Developer Tools Product Version:Version 6.3.1 (6D1002) & Swift 1.2
Classification:UI/Usability Reproducible:Always
Provide a descriptive summary of the issue.

Steps to Reproduce:
In numbered format, detail the exact steps taken to produce the bug.

See the gist
or attached playground for a full code example

The scenario this bug is about is the last one 
 If the closure has statements in it but no 
 return you get the confusing error message :

 Cannot invoke 'filterMap' with an argument list of type '((String) -> Int?)'
let transformedNoReturn : [Int] = array.filterMap({
    (data: String) -> Int? in

Expected Results:

Expected the error for the transformedNoReturn scenario to be the same as for transformedEmptyClosure that is "Missing return in a closure expected to return 'Int?'"

Actual Results:

the actual error message for the transformedEmptyClosure scenario is “Cannot invoke 'filterMap' with an argument list of type '((String) -> Int?)’”

This always occurs both in Xcode and Playgrounds using Xcode 6.3.1 and Swift 1.2

Provide additional information, such as references to related problems, workarounds and relevant attachments.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!