[swift-users] Compiler can't infer map transfer closure return type?

Jordan Rose jordan_rose at apple.com
Mon Mar 7 19:24:13 CST 2016

> On Mar 7, 2016, at 17:21, Erica Sadun <erica at ericasadun.com> wrote:
>> On Mar 7, 2016, at 6:15 PM, Jordan Rose via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>  Today there's at least a simple rule: if the closure consists of a single expression (or a single return statement), the compiler will look at the body; otherwise it won't.
> Would it be so hard to have a rule that if there's an unambiguous expression as the last line of a closure that
> it automagically acts as a default warn-on-unused-result return? So many of my two-line closures would
> benefit from this.

What does that mean? You can't see how the closure is being called, so how do you know if the result is used or unused?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160307/cbd2dd1d/attachment.html>

More information about the swift-users mailing list