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

Sourcery fails to generate valid mocks for Nested Protocols #1400

Open
szilipeti95 opened this issue Feb 2, 2025 · 0 comments
Open

Sourcery fails to generate valid mocks for Nested Protocols #1400

szilipeti95 opened this issue Feb 2, 2025 · 0 comments

Comments

@szilipeti95
Copy link

The problem is related to Swift's proposal for Nested Protocols. Sourcery is unable to generate valid mocks for nested protocols because it encounters invalid class names when it tries to generate the mock implementations.

With this proposal it is possible to define protocols like this:

class MyClass {
    // sourcery: AutoMockable
    protocol MyProtocol {
    }
}

Sourcery generates the following code which results in invalid class names:

class MyClass.MyProtocolMock: MyClass.MyProtocol {
}

The correct generated code should be:

class MyClassMyProtocolMock: MyClass.MyProtocol {
}

I know this is an experimental feature, but it would be great if Sourcery could support this.

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