<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Assuming you've merely omitted the code where you set closure to something and aren’t trying to read a variable before initializing it, I believe it's a bug... Using the "explicit" version works fine:</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> closure: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Closure</span><span style="font-variant-ligatures: no-common-ligatures" class="">? = </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">nil</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> otherClosure: </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Closure</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = {}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> pickClosure = </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">closure</span><span style="font-variant-ligatures: no-common-ligatures" class=""> != </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">nil</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ? </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">closure</span><span style="font-variant-ligatures: no-common-ligatures" class="">! : </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">otherClosure</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class="">- Dave Sweeris</div><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""></div></div></span></div><div class=""><br class=""></div></div></div><div><blockquote type="cite" class=""><div class="">On Feb 24, 2016, at 7:37 AM, Rudolf Adamkovič via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Hello there!</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Today, I stumbled upon the following error:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">typealias</span> ClosureType = () -> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> closure: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ClosureType</span>?</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> otherClosure: <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">ClosureType</span> = {}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> pickClosure = closure ?? otherClosure</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class="">// ERROR: binary operator '??' cannot be applied to operands of type 'ClosureType?' and 'ClosureType' (aka '() -> ()')</div><div class=""><br class=""></div><div class="">Is this a bug or a feature?</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">Rudolf Adamkovic</div><div class="">R+</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>