<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">We added the conversion to Void <i class="">specifically</i>&nbsp;because a lot of things return values that the caller doesn't care about. The most common case was</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">dispatch_sync(queue) { [weak sefl]</div><div class="">&nbsp; self?.doTheThing()</div><div class="">}</div></blockquote><div class=""><br class=""></div>I think it only makes sense to warn on conversion to Void if the expression being converted is itself one we would have warned on with @warn_unused_result, and in fact we do this already even in Swift 2.1.<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">func test() -&gt; Bool { return false }</div></div><div class=""><div class="">@warn_unused_result</div></div><div class=""><div class="">func test2() -&gt; Bool { return true }</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class="">func use(_: () -&gt; Void) {}</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class="">use { test() }</div></div><div class=""><div class="">use { test2() }</div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">So the real problem is that != isn't marked @warn_unused_result, which is&nbsp;<a href="https://bugs.swift.org/browse/SR-245" class="">SR-245</a>.</div><div class=""><br class=""></div><div class="">(Although I agree that if there's an explicit return and the expression doesn't have Void type, we should warn on the Void conversion as well. Or even error.)</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><div class=""><br class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 8, 2016, at 19:25 , Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Javier Soto brought up a case where his ReactiveCocoa code silently did the wrong thing by implicitly discarding the result of a closure:<br class=""><br class=""><a href="https://twitter.com/Javi/status/695680700033306624" class="">https://twitter.com/Javi/status/695680700033306624</a><br class=""><br class="">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.<br class=""><br class="">-Joe<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></div></div></body></html>