Skip to content
New issue

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

Compiler custom flags are not supported by Cuckoo generator #471

Open
DanyilNefodov opened this issue Jul 31, 2023 · 3 comments
Open

Compiler custom flags are not supported by Cuckoo generator #471

DanyilNefodov opened this issue Jul 31, 2023 · 3 comments

Comments

@DanyilNefodov
Copy link

Hi!

I have protocols which use Compiler custom flags. I have code similar to next one:

protocol Boo {
    func doesBoo(arg: Int64)
    #if FEATURE_FLAG
    func doesBooForFeature(arg: Int64)
    #endif
}

extension Boo {
    func doesBoo(arg: Int64) {
        doesBoo(arg: arg)
    }
    #if FEATURE_FLAG
    func doesBooForFeature(arg: Int64) {
        doesBooForFeature(arg: arg)
    }
    #endif
}

When I mock this code with FEATURE_FLAG disabled I get next error:
image

/path/to/mock/GeneratedMocks.swift:1757:45 Value of type 'any Boo' has no member 'doesBooForFeature'

I didn't found any reference to custom flags in Generator code/doc.

Could you help me please to understand is there any functionality for it? If not can it be supported in future?

@MatyasKriz
Copy link
Collaborator

Hey, this functionality probably isn't supported in Cuckoo. It might be easier to add it to the SwiftSyntax version I've been cooking up, but I haven't gotten around to finishing that up and releasing as Cuckoo 2.0 yet. 🙂

@MatyasKriz
Copy link
Collaborator

I've looked into implementing this and as it stands it will be a bit harder to add than I initially thought. Mainly because of #elseif that can be added into the mix. I'll keep it in mind though.

@MatyasKriz
Copy link
Collaborator

2 likes on that previous issue, so this might be useful to users, but I'm not sure if I'm able to add support for it before converting the generator to use SwiftFormat instead of Sourcery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants