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

Generics & Tuples not generating properly #522

Open
nmoersch-calimoto opened this issue Nov 12, 2024 · 1 comment
Open

Generics & Tuples not generating properly #522

nmoersch-calimoto opened this issue Nov 12, 2024 · 1 comment
Labels

Comments

@nmoersch-calimoto
Copy link

nmoersch-calimoto commented Nov 12, 2024

When using a Type with a Tuple as a generic, Cuckoo just aborts the generating of this definition. Instead of writing the fitting specified Tuple after < it just continues with the next step.
This results in compilation errors.

Here an example with different generic types. xSubject works.
Input:

var ySubject = PassthroughSubject<(err: Error, lastValue: Int?), Never>()
var xSubject = PassthroughSubject<Error, Never>()
var zResult = Result<(Int, Error?), Never>(catching: { return (0, nil) })

Output:

MockX {
    override var ySubject: PassthroughSubject< {
[...]
    override var xSubject: PassthroughSubject<Error, Never> {
[...]
    override var zResult: Result< {
[...]
}
__StubbingProxy_X {
        var ySubject: Cuckoo.ClassToBeStubbedProperty<MockLocationLogger,PassthroughSubject<> {
[...]
        var xSubject: Cuckoo.ClassToBeStubbedProperty<MockLocationLogger,PassthroughSubject<Error, Never>> {
[...]
        var zResult: Cuckoo.ClassToBeStubbedProperty<MockLocationLogger,Result<> {
[...]
}
__VerificationProxy_X {
        var ySubject: Cuckoo.VerifyProperty<PassthroughSubject<> {
[...]
        var xSubject: Cuckoo.VerifyProperty<PassthroughSubject<Error, Never>> {
[...]
        var zResult: Cuckoo.VerifyProperty<Result<> {
[...]
}

If the tuple is previously defined with a typealias the generation works fine.

@MatyasKriz MatyasKriz added the bug label Nov 14, 2024
@MatyasKriz
Copy link
Collaborator

Thanks for the report! Yup, seems like a bug. These complex types seem impossible to get right. 😄

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