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

type["SomeType"].variables[0].name returns whole line with comments for variable with property wrapper (swifttemplate, 2.0.1) #1140

Closed
artem-alexandrov opened this issue Feb 10, 2023 · 0 comments

Comments

@artem-alexandrov
Copy link

When trying to use variable.name I'm now getting whole line with comments, which breaks what should be after this insertion

example template:

// sourcery:inline:DemoTemplate
<% for variable in type["SomeType"]?.variables {
    print("\(variable.name) = 5")
}  -%>
// sourcery:end

example source:

@propertyWrapper
final class SomeWrapper {
    init() {
        wrappedValue = 0
    }

    var wrappedValue: Int
}

class SomeType {
    var variable1: Int = 2
    @SomeWrapper
    var variable2 // some comment
}

example result with 2.0.1 (which obviously produces compilation errors):

// sourcery:inline:DemoTemplate
variable1 = 5
variable2 // some comment = 5

// sourcery:end

example result with 1.9.2:

// sourcery:inline:DemoTemplate
variable1 = 5
variable2 = 5
// sourcery:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant