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

Method cannot be declared public because its parameter uses an internal type #437

Open
verebes1 opened this issue Nov 8, 2022 · 1 comment
Labels

Comments

@verebes1
Copy link

verebes1 commented Nov 8, 2022

Since updating to the latest version, I am getting build errors in GeneratedMocks due to type accessibility.
Property cannot be declared public because its type uses an internal type
or
Method cannot be declared public because its parameter uses an internal type

For example:

I have the following public class

public class client {
    internal var delegates: [ClientDelegate]
}

class [ClientDelegate] {
}

However, cuckoo is trying to make the delegates var public:

public override var delegates: [ClientDelegate] {
        get {
            return cuckoo_manager.getter("delegates",
                superclassCall:
                    
                    super.delegates
                    ,
                defaultCall: __defaultImplStub!.delegates)
        }
        
        set {
            cuckoo_manager.setter("delegates",
                value: newValue,
                superclassCall:
                    
                    super.delegates = newValue
                    ,
                defaultCall: __defaultImplStub!.delegates = newValue)
        }
    }

We do not want to make ClientDelegate a public class (this is a framework we are building) and we need the var to be internal so its value can easily be queried by tests.

I see this has been mentioned in issue #292 and addressed in PR #293
But the issue came back. Is there a way to solve this?

@MatyasKriz MatyasKriz added the bug label Dec 27, 2022
@MatyasKriz
Copy link
Collaborator

I've looked around the code and it seems that this issue is a bit more complex and I can't just revert the code that fixes the use-case in issue #316. That fix forces the property accessibility to the same level of the parent, but I understand your use-case as well. A workaround for now would be to make the internal type public.

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

No branches or pull requests

2 participants