[swift-evolution] Warning on the '(T...) -> U' to '(T...) -> ()' conversion

James Hillhouse IV jimhillhouse at me.com
Mon Feb 8 21:27:57 CST 2016


+1 for this idea.

> On Feb 8, 2016, at 9:25 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Javier Soto brought up a case where his ReactiveCocoa code silently did the wrong thing by implicitly discarding the result of a closure:
> 
> https://twitter.com/Javi/status/695680700033306624
> 
> Since it sounds like we plan on making `@warn_unused_result` the default, it seems natural to also warn when a closure has its result type converted away to Void. If there's one 'return' statement, we could dive into the return expression to decide whether to warn based on the function whose result is getting ignored.
> 
> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list