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

Generated code for a protocol which requires a generic initializer cause a compiler error #362

Open
myihsan opened this issue Aug 3, 2020 · 2 comments
Labels
bug PR submitted Used for issues with PR submitted that should contain the fix.

Comments

@myihsan
Copy link

myihsan commented Aug 3, 2020

protocol SomeProtocol {
    init<T>(t: T)
}

The code generated by the protocol above will have an initializer like below which cause a compiler error.

     required init(t: T) {
        
    }

It looks like the type placeholder is missing when generating for an initializer.

@MatyasKriz MatyasKriz added bug good first issue If you're looking to contribute, this issue is the way to go! labels Aug 3, 2020
@MatyasKriz
Copy link
Collaborator

Hi, @myihsan. This seems like a forgotten generic parameters string in the mock template, should be a fairly easy fix. Though the tests should have contained a generic init, I must have overlooked this.

@MatyasKriz
Copy link
Collaborator

Hey, I fixed this issue in the fix/protocol-generic-init, though I found out that generic methods in protocols aren't supported either. I'm not sure if it's possible to add that functionality with the current way it works, so I'll keep you posted in case I think of something and have the time to implement it.

@MatyasKriz MatyasKriz added PR submitted Used for issues with PR submitted that should contain the fix. and removed good first issue If you're looking to contribute, this issue is the way to go! labels Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PR submitted Used for issues with PR submitted that should contain the fix.
Projects
None yet
Development

No branches or pull requests

2 participants