[swift-users] Nil coalescing operator and closures

Rudolf Adamkovič salutis at me.com
Wed Feb 24 07:37:43 CST 2016


Hello there!

Today, I stumbled upon the following error:

typealias ClosureType = () -> Void
        
let closure: ClosureType?
let otherClosure: ClosureType = {}
        
let pickClosure = closure ?? otherClosure
// ERROR: binary operator '??' cannot be applied to operands of type 'ClosureType?' and 'ClosureType' (aka '() -> ()')

Is this a bug or a feature?

Thanks!

Rudolf Adamkovic
R+

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


More information about the swift-users mailing list