[swift-users] Nil coalescing operator and closures

Joe Groff jgroff at apple.com
Wed Feb 24 11:54:12 CST 2016


> On Feb 24, 2016, at 5:37 AM, Rudolf Adamkovič via swift-users <swift-users at swift.org> wrote:
> 
> 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?

It's a known bug.

-Joe

> 
> Thanks!
> 
> Rudolf Adamkovic
> R+
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

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


More information about the swift-users mailing list