Brightify / Cuckoo

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

Issue with variable name as `extension` #481

Closed levantAJ closed 5 months ago

levantAJ commented 9 months ago

Hi team I ran into an issue in my class there is a variable named extension, when generating the mocks I get this error message

Getter/setter can only be defined for a single variable
Keyword 'extension' cannot be used as an identifier here
If this name is unavoidable, use backticks to escape it

The class looks like:

class PurchasePathInterfaceProxy: NSObject, PurchasePathInterface {
    var `extension`: PurchasePathExtension?

    var isBrowserEnabled: Bool = false

    func fetch(request: PurchasePathRequest, completion: @escaping (PurchasePath?, Error?) -> Void) {
    }
}
Screenshot 2023-12-19 at 16 31 35
MatyasKriz commented 9 months ago

It seems like the support for escaping keywords wasn't extended to property names. I assume that it was merely forgotten.

I'll fix this for the upcoming 2.0 release. Thanks for noticing this! 🙂