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

Fixed incorrect case prefix parsing #1341

Merged
merged 1 commit into from
Jun 8, 2024
Merged

Conversation

art-divin
Copy link
Collaborator

Resolves #1340

Context

Given the following code:

// sourcery: AutoStubable
struct MyStruct {

    // sourcery: stub = "A"
    let basic: String

    // sourcery: stub = "B"
    let caseProperty: String

    // sourcery: stub = "C"
    let casesProperty: String

    // sourcery: stub = "D"
    let CaseProperty: String
}

and parsing implemented as follows:

let isInsideCaseDefinition = prefix.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("case")
prefix = prefix.trimmingPrefix("case").trimmingCharacters(in: .whitespaces)

an incorrect result is produced, because of the variable names starting with case.

@art-divin art-divin added this to the 2.2.5 milestone Jun 8, 2024
@art-divin art-divin self-assigned this Jun 8, 2024
@art-divin art-divin merged commit 418ebbe into master Jun 8, 2024
2 checks passed
@art-divin art-divin deleted the fix-case-prefix-parsing branch June 8, 2024 16:20
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

Successfully merging this pull request may close these issues.

Property annotation parsing broken for properties starting with the text case... in version 2.1.8 and later
1 participant