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-11672] Switch exhaustiveness fixit should not add @unknown default for frozen enums #54081

Closed
sjavora opened this issue Oct 27, 2019 · 2 comments
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement

Comments

@sjavora
Copy link
Contributor

sjavora commented Oct 27, 2019

Previous ID SR-11672
Radar None
Original Reporter @sjavora
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI
Assignee owenvoorhees (JIRA)
Priority Medium

md5: f5caad4357048c12d498bcefbaeb33f1

Issue Description:

Given

enum PowerSource {
    case battery
    case powerAdapter
}

let source = PowerSource.battery

switch source {

}

the fixit generates the following:

switch source {

    case .battery:
    <#code#>
    case .powerAdapter:
    <#code#>
    @unknown default:
    <#code#>
}

Upon filling the placeholders, the compiler immediately complains that Default will never be executed. The fixit should not add the @unknown default.

@belkadan
Copy link
Contributor

Oops. cc @CodaFi

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

PR: #28476

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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 diagnostics QoI Bug: Diagnostics Quality of Implementation improvement
Projects
None yet
Development

No branches or pull requests

3 participants