Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.03k
stars
104
forks
source link
Missing parenthesis optional existential type (any ProtocolName) properties #338
protocol MyProtocol { // sourcery: AutoMockable
var item: (any AnotherProtocol)? { get set }
}
I get this property in my generated mock code:
public var item: any AnotherProtocol? {
get { invocations.append(.p_item_get); return __p_item ?? optionalGivenGetterValue(.p_item_get, "MyProtocolMock - stub value for item was not defined") }
set { invocations.append(.p_item_set(.value(newValue))); __p_item = newValue }
}
With the compiler error:
Optional 'any' type must be written '(any AnotherProtocol)?'
I am using:
Sourcery 1.9.2 installed via Mint or 2.0.0 installed via Homebrew (checked both and altered my sourceryCommand accordingly)
SwiftyMocky CLI v4.2.0
Swift 5.7.2 (Xcode 14.2 (14C18))
Obviously the expectation and correct code generation is any AnotherProtocol wrapped in parenthesis.
Am I doing something wrong? Is this not supported yet? Is this actually a SwiftyMocky or Sourcery issue? I always an insecure about the latter when encountering issues. 😁 Strangely, I have not found any existing issue for this.
Having this protocol:
I get this property in my generated mock code:
With the compiler error:
I am using:
sourceryCommand
accordingly)Obviously the expectation and correct code generation is
any AnotherProtocol
wrapped in parenthesis.Am I doing something wrong? Is this not supported yet? Is this actually a SwiftyMocky or Sourcery issue? I always an insecure about the latter when encountering issues. 😁 Strangely, I have not found any existing issue for this.