thoughtbot/Argo

Xcode 11.2.1 Binary operator '<^>' cannot be applied to operands of type

MervinFlores opened this issue · 7 comments

I has the follow code implemented to work with Argo framework, has been working until the Xcode 11.2.1 update. when I updated my Xcode Version the follow error appears:

Error Messages

Binary operator '<^>' cannot be applied to operands of type '(()) -> VoiceMailNumberResponse' and 'Decoded<_?>'

Models

Here's my code:

struct VoiceMailNumberResponse{
    var name: String?
    var value: String?
}

extension VoiceMailNumberResponse: Argo.Decodable {
    static func decode(_ json: JSON) -> Decoded<VoiceMailNumberResponse> {
        let voiceMailNumberResponse = curry(VoiceMailNumberResponse.init)
        return voiceMailNumberResponse
            <^> json <|?  "name"
            <*> json <|?  "value"
    }
}

Error appears on line:

"<^> json <|?  "name"

In addition I'm using Argo, Curry and Runes for parsing JSON.

Argo Version

Argo 4.2.0

Dependency Manager

Cocoapods

I have similar errors in my project

It sounds like something changed with precedence or type inference. I don't have much time to dig into this right now, but if someone wants to look into this I'm happy to help however I can.

Oh it might also be something that changed with the type of the initializer? That type signature implies that the curried initializer doesn't take any arguments.

This error is accompanied by a hint

Messages

"1. Overloads for '<^>' exist with these partially matching parameter lists: ((T) -> U, Decoded), ((T) -> U, Result<T, E>), ((T) -> U, T?), ((T) -> U, [T])"

Makes sense, although it's unfortunate. I assume the other way to fix this would be to define an explicit initializer, which would keep Swift for synthesizing them for you.

I'm going to go ahead and close this due to inactivity but please feel free to reopen if this is still an issue.