jimmya / sourcery-templates

MIT License
6 stars 6 forks source link

Generated stubs erroneously include argument label #29

Open wvteijlingen-npo opened 2 weeks ago

wvteijlingen-npo commented 2 weeks ago

For initializers with unnamed parameters, the template erroneously includes the argument label in the generated stub function.

For example:

Input

// sourcery: AutoStubbable
struct Foo {
    init(_ value: String) {
        //
    }
}

Expected output

internal extension Foo {
    static func stub(
        value: String = ""
    ) -> Foo {
        Foo(
            value
        )
    }
}

Actual output

internal extension Foo {
    static func stub(
        value: String = ""
    ) -> Foo {
        Foo(
            value: value // <- Compiler error: "Extraneous argument label 'value:' in call"
        )
    }
}