[swift-users] Two Obj-C visible functions no longer overload?

Jordan Rose jordan_rose at apple.com
Mon Aug 8 16:04:24 CDT 2016


I would definitely expect these two to conflict, so if they previously compiled happily I would guess that’s a bug we fixed. The most likely possibility is that we didn’t allow making arrays of errors and now we do.

Jordan


> On Aug 5, 2016, at 14:57, Jon Shier via swift-users <swift-users at swift.org> wrote:
> 
> Swifters:
> 	I’m attempting to update some library code to beta 4 and I’ve run into something that’s either a bug or a deliberate change. In a class that’s a Foundation.Operation subclass, there are two finish() functions:
> 
> final func finish(_ receivedErrors: [Error] = []) {
>     _finish(receivedErrors, fromCancel: false)
> }
> 
> /// Convenience method to simplify finishing when there is only one error.
> final func finish(_ receivedError: Error?) {
>     finish(receivedError.map { [$0]} ?? [])
> }
> 
> Prior to beta 4 these functions lived side by side quite happily. In beta 4, however, their existence produces this error:
> 
> method 'finish' with Objective-C selector 'finish:' conflicts with previous declaration with the same Objective-C selector
> 
> Now, if I mark one of the functions @nonobjc, it compiles. So is this a bug or change in behavior?
> 
> 
> 
> Jon Shier
> _______________________________________________
> 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/20160808/60456e1b/attachment.html>


More information about the swift-users mailing list