Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise+Retry.swift fails to build for swift version <= 4 #55

Closed
adlerj opened this issue Jul 9, 2018 · 3 comments
Closed

Promise+Retry.swift fails to build for swift version <= 4 #55

adlerj opened this issue Jul 9, 2018 · 3 comments

Comments

@adlerj
Copy link

adlerj commented Jul 9, 2018

When we are on swift version < 4.1 the predicateBlock has type
var predicateBlock: ((_ count: Int, _ error: Error) -> ObjCBool)?

This gives an error when used below in the onQueue call because the condition type is defined as:
typedef BOOL (^FBLPromiseRetryPredicateBlock)(NSInteger, NSError *)

Cannot convert value of type '((Int, Error) -> ObjCBool)?' to expected argument type '((Int, Error) -> Bool)?'
@adlerj
Copy link
Author

adlerj commented Jul 9, 2018

I'm not sure that the swift version check is even necessary...

"C typedefs of block types are imported as typealiass for Swift closures.

The primary result of this is that typedefs for blocks with a parameter of type BOOL are imported as closures with a parameter of type Bool (rather than ObjCBool as in the previous release). This matches the behavior of block parameters to imported Objective-C methods. (22013912)"

https://github.com/apple/swift/blob/master/CHANGELOG.md

@ghost
Copy link

ghost commented Jul 9, 2018

Appears that the issue has to do with the Xcode version rather than a specific Swift version. So checking if Swift version is >=4.1 will not suffice.

Based on the check used here:
realm/SwiftLint@133cef8

We will need to do the following:
(!swift(>=4.1) || (!swift(>=4.0) && swift(>=3.3)))

@jonathanekim
Copy link
Contributor

I believe #59 fixes this issue. Please reopen if it does not!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants