Skip to content

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

@akyrtzi

Description

@akyrtzi
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerThe Swift compiler itselffeatureA feature request or implementationgood first issueGood for newcomersrefactoringArea → source tooling: refactoringsource toolingArea: IDE support, SourceKit, and other source tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions