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-5794] Expand a ternary operator into an if statement and vice-versa #48364

Closed
akyrtzi opened this issue Aug 29, 2017 · 10 comments
Closed

[SR-5794] Expand a ternary operator into an if statement and vice-versa #48364

akyrtzi opened this issue Aug 29, 2017 · 10 comments
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 29, 2017

Previous ID SR-5794
Radar rdar://32751037
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 romanroibu (JIRA)
Priority Medium

md5: 4c821f590e264347c4d79d13cd5eb470

Issue Description:

When selecting a ternary expression

    let x = expression ? a : b

Suggest expanding to an if-else:

    let x: Int
    if expression {
        x = a
    } else {
        x = b
    }

And vice-versa.

@swift-ci
Copy link
Collaborator

swift-ci commented Sep 5, 2017

Comment by Roman Roibu (JIRA)

Hi @akyrtzi,

Is anybody working on this issue?
If not, I would like to give it a try, though I might have some questions along the way.

Thanks!

@akyrtzi
Copy link
Member Author

akyrtzi commented Sep 5, 2017

Is anybody working on this issue?

Not AFAIK. Note that it is 'Unassigned'.

@swift-ci
Copy link
Collaborator

Comment by KacperHarasim (JIRA)

Hi romanroibu (JIRA User), are you working on this? Asking because the issue is still unassigned. Thanks!

@swift-ci
Copy link
Collaborator

Comment by Roman Roibu (JIRA)

Hi kacperh (JIRA User). Yes, I'm working on this, but making slow progress. I'll change the assignee status, thanks!

@swift-ci
Copy link
Collaborator

Comment by KacperHarasim (JIRA)

Great

@swift-ci
Copy link
Collaborator

Comment by Roman Roibu (JIRA)

Opened a PR to implement this: #12554

@akyrtzi
Copy link
Member Author

akyrtzi commented Feb 3, 2018

Is this resolved ?

@NachoSoto
Copy link
Contributor

PR is merged, but this isn't on Xcode 9.3 beta 1?

@akyrtzi
Copy link
Member Author

akyrtzi commented Feb 3, 2018

This came after the 'swift-4.1' branch and was not merged to that. We should have notified Roman to do another PR for swift-4.1.

Unfortunately, at this point we are in convergence mode and only aim to get critical fixes into that branch.

@swift-ci
Copy link
Collaborator

Comment by Anton Vlasov (JIRA)

This works fine at Xcode 10.1 (10B61). I think the issue should be closed.

@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

4 participants