PromiseKit: 3.0.0: Cannot call value of non-function type 'ErrorType?'
Installed PromiseKit 3.0.0 via Cocoapods. The following code generates a compile error (Xcode Version 7.2 (7C68)):
let (p2, _, _) = Promise<Void>.pendingPromise()
p2.error { error -> Void in
        NSLog("Error: %@", error)
}
This appears to be because Promise+Properties.swift defines public var error: ErrorType? and Promise.swift defines public func error(policy policy: ErrorPolicy = .AllErrorsExceptCancellation, _ body: (ErrorType) -> Void).
I’m not sure Swift allows you to have properties with the same names as functions. The Swift compiler is getting confused.
About this issue
- Original URL
 - State: closed
 - Created 8 years ago
 - Comments: 17 (11 by maintainers)
 
It happens to me often when the code within the
errorblock has compiler errors. For instance:But the actual error is within the
errorblock:TripRequestCancelFailedis a static member of the current class, not a global variable. A good way to debug this is by moving your error code outside of the error block, and see what the compiler says.Not sure it’s the cause of your issue, but I thought it was worth mentioning.
@orj @nathanhosselton
I get the same error and can’t figure out how to solve it. Any tips?
Thanks!