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

redundantSelf incorrectly adds self. to keypath not referencing its own variable. #1911

Open
lhunath opened this issue Oct 22, 2024 · 0 comments

Comments

@lhunath
Copy link

lhunath commented Oct 22, 2024

class UserScreenPresenter: ScreenPresenter {
    func onAppear() {
        self.sessionInteractor.stage.compactMap(\.?.session).latestValues(on: .main)
    }

    private var session: Session?
}
$ swiftformat --self insert --selfrequired -v test.swift
Running SwiftFormat...
Reading swift-version file at /Users/hubstaff/Developer/hubstaff/ios/.swift-version (version 5.8)
Formatting /Users/hubstaff/Developer/hubstaff/ios/test.swift
-- rules applied: redundantSelf
Writing /Users/hubstaff/Developer/hubstaff/ios/test.swift
SwiftFormat completed in 0.01s.
1/1 files formatted.

It appears that SwiftFormat incorrectly assumes the keypath is referring to a property on UserScreenPresenter while this is not the case.

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