Example:
public func fetchAllAvailableRoutes() -> Promise<[Route]> {...}
firstly{
self.fetchAllAvailableRoutes()
}
The example above always ends up in a compiler warning for me, saying
Ambiguous reference to member 'firstly(execute:)'
pointing to both implementations of firstly as a viable candidate.
fetchAllAvailableRoutes doesn't return a Guarantee though and omitting firstly and simply going to use fetchAllAvailableRoutes().then{...} works though
Can't be helped, you just have to keep typing or provide a return type like our troubleshooting guide says.
I found there were a lot of places where I had firstly{}.then where I wanted either firstly{}.done or firstly{}.map and the errors went away after that. Unfortunately swift has a hard time figuring out where to show the real error when it comes to closures.
Thanks, I have update the troubleshooting guide to suggest this scenario.
I also recently got this error from the following code:
firstly {
aPromise()
}.then { value -> Promise<SomethingElse>
return anotherPromise()
}
The issue was I was missing the "in" in the then clause. It's too bad swift won't show you the error on the .then clause, instead it bubbles up to the firstly event though that part is fine.
A missing in is covered in our Troubleshooting guide.
Can you point out where? Read the guide but not seeing it.
https://github.com/mxcl/PromiseKit/blob/master/Documentation/Troubleshooting.md#acknowledge-all-incoming-closure-parameters
Most helpful comment
I also recently got this error from the following code:
The issue was I was missing the "in" in the then clause. It's too bad swift won't show you the error on the .then clause, instead it bubbles up to the firstly event though that part is fine.