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

[SR-5744] Refactoring action to convert if-let to guard-let and vice versa #48314

Closed
akyrtzi opened this issue Aug 23, 2017 · 5 comments
Closed
Labels
compiler The Swift compiler in itself feature A feature request or implementation good first issue Good for newcomers refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@akyrtzi
Copy link
Member

akyrtzi commented Aug 23, 2017

Previous ID SR-5744
Radar rdar://32751558
Original Reporter @akyrtzi
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels New Feature, Refactoring, StarterProposal
Assignee flap (JIRA)
Priority Medium

md5: 7ef7045d1f66d780dc2357b69e0b441a

Issue Description:

Implement action to convert from:

func foo(idxOpt: Int?) {
  if let idx = idxOpt {
    print(idx)
  }
}

to

func foo(idxOpt: Int?) {
  guard let idx = idxOpt else {
    return
  }
  print(idx)
}

and vice-versa

@swift-ci
Copy link
Collaborator

Comment by KacperHarasim (JIRA)

Hi biscuit (JIRA User), are you working on this?

@swift-ci
Copy link
Collaborator

Comment by Michael Thomas (JIRA)

@KacperHarasim yes, I just about have it working - I’m planning on opening a PR sometime next week.

@swift-ci
Copy link
Collaborator

Comment by KacperHarasim (JIRA)

biscuit (JIRA User) Great, thanks for the answer. Good luck!

@swift-ci
Copy link
Collaborator

swift-ci commented May 7, 2019

Comment by Anton Vlasov (JIRA)

PR for this issue is created: #24566

@swift-ci
Copy link
Collaborator

Comment by Anton Vlasov (JIRA)

Merged to master.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler in itself good first issue Good for newcomers feature A feature request or implementation source tooling Area: IDE support, SourceKit, and other source tooling and removed new feature StarterProposal labels Nov 11, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation good first issue Good for newcomers refactoring Area → source tooling: refactoring source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants