You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// sourcery: AutoMockable
public protocol Foo {
@discardableResult
func register<C, V>(key: Key, coder: C) -> TypedKey<V> where C: Coder, C.Value == V
}
produces the following output:
public class MockFoo: Foo {
public init() {}
//MARK: - register<C, V>
public var registerCVKeyKeyCoderCTypedKeyVCallsCount = 0
public var registerCVKeyKeyCoderCTypedKeyVCalled: Bool {
return registerCVKeyKeyCoderCTypedKeyVCallsCount > 0
}
public var registerCVKeyKeyCoderCTypedKeyVReceivedArguments: (key: Key, coder: C)? // compiler error: Cannot find type 'C' in scope
public var registerCVKeyKeyCoderCTypedKeyVReceivedInvocations: [(key: Key, coder: C)] = [] // compiler error: Cannot find type 'C' in scope
public var registerCVKeyKeyCoderCTypedKeyVReturnValue: TypedKey<V> where C: Coder, C.Value == V! // multiple compiler issues
public var registerCVKeyKeyCoderCTypedKeyVClosure: ((Key, C) -> TypedKey<V> where C: Coder, C.Value == V)? // multiple compiler issues
@discardableResult
public func register<C, V>(key: Key, coder: C) -> TypedKey<V> where C: Coder, C.Value == V {
registerCVKeyKeyCoderCTypedKeyVCallsCount += 1
registerCVKeyKeyCoderCTypedKeyVReceivedArguments = (key: key, coder: coder)
registerCVKeyKeyCoderCTypedKeyVReceivedInvocations.append((key: key, coder: coder))
if let registerCVKeyKeyCoderCTypedKeyVClosure = registerCVKeyKeyCoderCTypedKeyVClosure {
return registerCVKeyKeyCoderCTypedKeyVClosure(key, coder)
} else {
return registerCVKeyKeyCoderCTypedKeyVReturnValue
}
}
}
Here I have no idea how to solve this as we can't use generics for the registerCVKeyKeyCoderCTypedKeyVReturnValue definition
Maybe it is best to omit the generation of registerCVKeyKeyCoderCTypedKeyVReturnValue and registerCVKeyKeyCoderCTypedKeyVClosure if it can't be solved automatically
The text was updated successfully, but these errors were encountered:
sourcery version: 2.2.6
swift version: 6.0.3
Using the following protocol
produces the following output:
Here I have no idea how to solve this as we can't use generics for the
registerCVKeyKeyCoderCTypedKeyVReturnValue
definitionMaybe it is best to omit the generation of
registerCVKeyKeyCoderCTypedKeyVReturnValue
andregisterCVKeyKeyCoderCTypedKeyVClosure
if it can't be solved automaticallyThe text was updated successfully, but these errors were encountered: