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

Fix bug where if statement body could be incorrectly parsed as trailing closure #1719

Merged

Conversation

calda
Copy link
Collaborator

@calda calda commented Jun 7, 2024

This PR fixes a bug where the body of an if statement could be incorrectly parsed as a trailing closure.

This fixes an issue where the redundantProperty rule would incorrectly convert this code:

func foo() -> Foo {
    let foo = Foo(bar: bar, baaz: baaz)

    if let foo = foo.nestedFoo {
        print(foo)
    }

    return foo
}

to:

func foo() -> Foo {
    let foo = Foo(bar: bar, baaz: baaz)

    if return foo.nestedFoo {
        print(foo)
    }
}

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.16%. Comparing base (49330c8) to head (3b64a83).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1719      +/-   ##
===========================================
- Coverage    95.17%   95.16%   -0.01%     
===========================================
  Files           20       20              
  Lines        23177    23185       +8     
===========================================
+ Hits         22058    22065       +7     
- Misses        1119     1120       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nicklockwood nicklockwood merged commit 56723db into nicklockwood:develop Jun 8, 2024
7 checks passed
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.

2 participants