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-14772] Convert to async can’t handle switch over Result enum #57122

Closed
ahoppen opened this issue Jun 14, 2021 · 1 comment
Closed

[SR-14772] Convert to async can’t handle switch over Result enum #57122

ahoppen opened this issue Jun 14, 2021 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Jun 14, 2021

Previous ID SR-14772
Radar rdar://79279846
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug
Assignee @ahoppen
Priority Medium

md5: 83e9aa20492f934e96973d5d001d4f72

Issue Description:

The following test case fails to refactor to async with the error message cannot refactor complex case conditions. Binding response as case .success(let response) works around the issue.

func fetch(_ completion: (Result<Int, Error>) -> Void) {}

// RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):3
func execute() {
    fetch() { (result: Result<Int, Error>) in
        switch result {
        case let .success(response):
            print(response)
        case .failure(_):
            break
        }
    }
}
@ahoppen
Copy link
Contributor Author

ahoppen commented Jun 15, 2021

#37899

@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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant