Skip to content

Generated code does not follow the enclosing class access control #42

Description

@GustavoVergara

When code is generated it doesn’t set an access control to anything.
This raises a compiler error when both the protocol and the mock class are public/open.

For example, this protocol and class:

public protocol FooProtocol {
    func bar(arg: String) -> Int
}

public class FooSpy: FooProtocol {
    var invokedBar = false
    var invokedBarCount = 0
    var invokedBarParameters: (arg: String, Void)?
    var invokedBarParametersList = [(arg: String, Void)]()
    var stubbedBarResult: Int! = 0

    func bar(arg: String) -> Int {
        invokedBar = true
        invokedBarCount += 1
        invokedBarParameters = (arg, ())
        invokedBarParametersList.append((arg, ()))
        return stubbedBarResult
    }
}

Raises the error:
image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions