Closed normanzb closed 7 months ago
Hey, @normanzb, I haven't tested Cuckoo with Swift 5.8.1, but it seems like this issue might be a pretty big deal. I wonder why the any
is necessary all of a sudden? According to this article it should be an error from Swift 6 onward.
Welp, seems like it's not that big of a deal based on the lack of reactions. If you're still encountering this issue and have a proposal on how to fix it, please reopen the issue and let me know. 🙂
FYI, I encountered the same problem recently.
I found that Swift requires the any
keyword because a protocol uses Self
in its definition.
The Self
enables the compiler to know it is an Opaque type for better optimization. However, the generated mock needs to store it as a property or pass it in a method parameter. So, it requires the any
as an Existential type.
In my case, the protocol conforms to Equatable originally. But I remove the Equatable from the protocol definition. So, the generated mock is now okay without the any
as a type.
I've added any
to all protocols in 2.0.3, so it shouldn't cause warnings at all going forward.
@MatyasKriz Nice, thanks for the efforts. 👍
Hi there,
Does Cuckoo support swift 5.8.1? if not then is there a plan to support 5.8+? when i generated the mocks with cuckoo 1.10.3 I got plenty errors such as:
thx!