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

Invalid redeclaration error in .generated file while using tuples with typealias #342

Open
katobi opened this issue Feb 23, 2023 · 0 comments

Comments

@katobi
Copy link

katobi commented Feb 23, 2023

Issue Description

We are currently using version 4.0.4 of SwiftyMocky without any issues. However, when we try to update to version 4.1.0, we encounter an issue where one of our protocol functions is generated with a duplicate function. I have identified that this issue is related to the return type of the function.

I have created an example protocol to demonstrate the issue:

typealias TupleTest = (param0: Bool, param1: Int)

// sourcery: AutoMockable
protocol BrokenProtocol {
    func test(_ parameter: Bool) -> TupleTest
    func test(_ parameter: Bool, parameter1: Int) -> TupleTest
}

extension BrokenProtocol {
    func test(_ parameter: Bool, parameter1: Int) -> TupleTest {
        return test(parameter)
    }
}

When we remove the extension, the protocol generates without any issues. Additionally, if we don't use typealiases as return values and instead use an actual tuple like this:

 func test(_ parameter: Bool) -> (param0: Bool, param1: Int)
 func test(_ parameter: Bool, parameter1: Int) -> (param0: Bool, param1: Int)

It also generates fine. We are curious to know why this behavior is occurring and if there is a way to make SwiftyMocky work as it was.

Environment

SwiftyMocky version: 4.1.0
Xcode version: 14.1

Thanks,
Cagatay.

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

1 participant