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

Swift 4 generated mock causes an error - invalid conversion... #151

Closed
markturner opened this issue Oct 11, 2017 · 2 comments
Closed

Swift 4 generated mock causes an error - invalid conversion... #151

markturner opened this issue Oct 11, 2017 · 2 comments

Comments

@markturner
Copy link

markturner commented Oct 11, 2017

Hi guys,

So I've just got Xcode 9 and have followed the instructions to convert to swift 4. I'm using 0.10.0 of Cuckoo. Everything is fine except GeneratedMocks.swift has this code in it:

    // ["name": "httpClient", "accesibility": "", "@type": "InstanceVariable", "type": "HttpClientProtocol", "isReadOnly": false]
     override var httpClient: HttpClientProtocol {
        get {
            return cuckoo_manager.getter("httpClient", original: observed.map { o in return { () -> HttpClientProtocol in o.httpClient }})
        }
        
        set {
            cuckoo_manager.setter("httpClient", value: newValue, original: observed != nil ? { self.observed?.httpClient = $0 } : nil)
        }
        
    }

Which causes the following error when building:

Invalid conversion from throwing function of type '((Schedule) throws -> _) throws -> _?' to non-throwing function type '((Schedule) throws -> () -> HttpClientProtocol) -> ((()) -> _)?'

Do I need to change my class to prevent this? Or anything else I can do? I don't really get much from that error to be honest! This has worked today but I can't get past this error now, I haven't knowingly changed anything else.

Any advice you can give would be appreciated, let me know if you need any further info.

Many thanks!

@TadeasKriz
Copy link
Member

Fixed in 0.10.1.

@arkilis
Copy link

arkilis commented Sep 27, 2018

Still exists in 0.10.2

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

No branches or pull requests

3 participants