We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The generated Automockable does not compile in case of a procotol contains reference to a composite type
Exemple:
For a given protocol:
protocol FooProtocol {} protocol BarProtocol {} // sourcery: AutoMockable protocol AProtocol { func execute(parameter: any (FooProtocol & BarProtocol)) }
The generated mock should look like this:
class AProtocolMock: AProtocol { //MARK: - execute var executeParameterAnyFooProtocolBarProtocolVoidCallsCount = 0 var executeParameterAnyFooProtocolBarProtocolVoidCalled: Bool { return executeParameterAnyFooProtocolBarProtocolVoidCallsCount > 0 } var executeParameterAnyFooProtocolBarProtocolVoidReceivedParameter: (any (FooProtocol & BarProtocol))? var executeParameterAnyFooProtocolBarProtocolVoidReceivedInvocations: [(any (FooProtocol & BarProtocol))] = [] var executeParameterAnyFooProtocolBarProtocolVoidClosure: ((any (FooProtocol & BarProtocol)) -> Void)? func execute(parameter: any (FooProtocol & BarProtocol)) { executeParameterAnyFooProtocolBarProtocolVoidCallsCount += 1 executeParameterAnyFooProtocolBarProtocolVoidReceivedParameter = parameter executeParameterAnyFooProtocolBarProtocolVoidReceivedInvocations.append(parameter) executeParameterAnyFooProtocolBarProtocolVoidClosure?(parameter) } }
However it looks like this: (notice the presence of & in the variables names)
&
class AProtocolMock: AProtocol { //MARK: - execute var executeParameterAnyFooProtocol&BarProtocolVoidCallsCount = 0 var executeParameterAnyFooProtocol&BarProtocolVoidCalled: Bool { return executeParameterAnyFooProtocol&BarProtocolVoidCallsCount > 0 } var executeParameterAnyFooProtocol&BarProtocolVoidReceivedParameter: (any (FooProtocol & BarProtocol))? var executeParameterAnyFooProtocol&BarProtocolVoidReceivedInvocations: [(any (FooProtocol & BarProtocol))] = [] var executeParameterAnyFooProtocol&BarProtocolVoidClosure: ((any (FooProtocol & BarProtocol)) -> Void)? func execute(parameter: any (FooProtocol & BarProtocol)) { executeParameterAnyFooProtocol&BarProtocolVoidCallsCount += 1 executeParameterAnyFooProtocol&BarProtocolVoidReceivedParameter = parameter executeParameterAnyFooProtocol&BarProtocolVoidReceivedInvocations.append(parameter) executeParameterAnyFooProtocol&BarProtocolVoidClosure?(parameter) } }
The text was updated successfully, but these errors were encountered:
This PR should fix this issue
Sorry, something went wrong.
thanks for contributing!
No branches or pull requests
The generated Automockable does not compile in case of a procotol contains reference to a composite type
Exemple:
For a given protocol:
The generated mock should look like this:
However it looks like this: (notice the presence of
&
in the variables names)The text was updated successfully, but these errors were encountered: