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

Joe Groff jgroff at apple.com
Mon Feb 8 21:25:09 CST 2016


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


More information about the swift-evolution mailing list