Closed lvsti closed 7 years ago
Hmm it's weird that I can't reproduce it in #482 🤔
Well, one difference is that in your build you are building Nimble while in mine I'm building my project with Nimble as a dependency.
On a side note, have you checked that your newly added Package@swift-4.swift
manifest actually gets parsed? In my setup, if I only have that in the repo root, SPM greets me with error: root manifest not found
FWIW, the libFoundation.a
of the 4.0.2 Linux distribution of Swift indeed contains 2 symbols for NotificationCenter.addObserver:
$ swift demangle _T010Foundation18NotificationCenterC11addObserverAA16NSObjectProtocol_pAA14NSNotificationC4NameVSg03forI0_ypSg6objectAA14OperationQueueCSg5queueyAA0B0Vc10usingBlocktF
_T010Foundation18NotificationCenterC11addObserverAA16NSObjectProtocol_pAA14NSNotificationC4NameVSg03forI0_ypSg6objectAA14OperationQueueCSg5queueyAA0B0Vc10usingBlocktF ---> Foundation.NotificationCenter.addObserver(forName: Foundation.NSNotification.Name?, object: Any?, queue: Foundation.OperationQueue?, usingBlock: (Foundation.Notification) -> ()) -> Foundation.NSObjectProtocol
$ swift demangle _T010Foundation18NotificationCenterC11addObserverAA16NSObjectProtocol_pAA14NSNotificationC4NameVSg03forI0_ypSg6objectAA14OperationQueueCSg5queueyAA0B0Vc5usingtF
_T010Foundation18NotificationCenterC11addObserverAA16NSObjectProtocol_pAA14NSNotificationC4NameVSg03forI0_ypSg6objectAA14OperationQueueCSg5queueyAA0B0Vc5usingtF ---> Foundation.NotificationCenter.addObserver(forName: Foundation.NSNotification.Name?, object: Any?, queue: Foundation.OperationQueue?, using: (Foundation.Notification) -> ()) -> Foundation.NSObjectProtocol
I'm not sure if this is a bug or a feature, but I believe that by explicitly choosing one or the other form at https://github.com/Quick/Nimble/blob/master/Sources/Nimble/Matchers/PostNotification.swift#L18 instead of the trailing closure syntax would resolve the issue.
Hmm it's really annoying that the ambiguous overloads are introduced only in Swift 4.0.2 😞
What did you do?
I upgraded my OSS project to use Swift 4 and tried to build the thing on a Travis Linux (Ubuntu 14.04.5) machine. The package manifest for my project:
What did you expect to happen?
swift build && swift test
to execute properly.What actually happened instead?
There was a compilation error while the SPM was building the dependencies:
Environment
List the software versions you're using: