-
Notifications
You must be signed in to change notification settings - Fork 332
Add if let to guard and Vice versa transforms #2420
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
base: main
Are you sure you want to change the base?
Conversation
ahoppen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for implementing this refactoring, @PhantomInTheWire ❤️
The PR is already pretty large, so I’d suggest we focus on the if -> guard refactoring in this PR first and leave guard -> if for a follow-up PR, to simplify review.
I left some first initial comments in the PR. The overall direction seems great and you thought about many edge cases. I’ll do another thorough review once the first set of comments are addressed.
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
5e90594 to
410ce27
Compare
ahoppen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started reviewing this again but then realized that you haven’t addressed all my previous comments yet (no problem with that, just didn’t realize before I started reviewing), so stopped half-way.
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftLanguageService/CodeActions/ConvertIfLetToGuard.swift
Outdated
Show resolved
Hide resolved
Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
…anteesExit Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
… doesn't exist Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
Signed-off-by: Karan <[email protected]>
410ce27 to
3f71cc6
Compare
fixes: #1569
mostly works but not sure what to do with many edge cases and has a todo for switch statements, also this will probably have conflicts with #2406 marking as draft till that merges and i can resolve the conflicts.
Screen.Recording.2026-01-04.at.17.03.17.mov