Brightify / Cuckoo

Boilerplate-free mocking framework for Swift!
MIT License
1.67k stars 175 forks source link

Failed to generate mocks with property wrapper #428

Closed Tyler-Keith-Thompson closed 1 year ago

Tyler-Keith-Thompson commented 2 years ago

Hello! I'm getting a phase script error of /Pods/Cuckoo/cuckoo_generator: terminated with signal 4; aborting.

I have narrowed it down and believe it's the following line that's causing an issue

@LazyInjected(Container.service) private var service

MatyasKriz commented 2 years ago

I see, thanks for the report! Do you think just ignoring the wrapper would be a sufficient fix?

andreasziegl commented 1 year ago

Hi @MatyasKriz,

we have the same issue. We always define protocols and the corresponding class in one file and generate the mocks via --no-class-mocking. Even in this scenario the error occurs. --exclude does unfortunately also not help The only workaround we have right now is to split the protocol and the class definition into different files, which is not really nice

kabiroberai commented 1 year ago

fyi this appears to be a duplicate of #341. I have a fix I'll be making a PR for soon (boils down to https://github.com/kabiroberai/Cuckoo/commit/7ea36690c8ad2587004aed2e5229bbd92e4128d9 + some unit tests) — this doesn't allow you to mock property wrappers with inferred types but at least it allows Cuckoo to parse the file without halting and catching fire.