Skip to content

[Refactoring] Convert completion handler when converting function to async #37110

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

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Apr 28, 2021

Convert function to async currently only adds "async" to the function and runs the convert call refactoring on the body.

This was intentional, but it turns out to be somewhat confusing. Instead, run the same refactoring as the add async alternative refactoring but just replace rather than add.

@ahoppen ahoppen requested a review from bnbarham April 28, 2021 14:47
@ahoppen ahoppen force-pushed the pr/convert-completion-handler branch from 95b29be to f58f4c5 Compare April 28, 2021 14:55
@ahoppen
Copy link
Member Author

ahoppen commented Apr 28, 2021

@swift-ci Please test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise, thanks!

// RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=PROTO-MEMBER-TO-ASYNC %s
// RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):3 | %FileCheck -check-prefix=PROTO-MEMBER %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test that checks that it does actually convert and not add anywhere? See the top of this file for an example (it's for add-async, convert should have an actual range rather than a 0 length one).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think so. I’ll add one in a follow-up PR.

@ahoppen
Copy link
Member Author

ahoppen commented Apr 29, 2021

@swift-ci Please test Windows

…async

Convert function to async currently only adds "async" to the function and runs the convert call refactoring on the body.

This was intentional, but it turns out to be somewhat confusing. Instead, run the same refactoring as the add async alternative refactoring but just replace rather than add.

Resolves rdar://77103049
@ahoppen ahoppen force-pushed the pr/convert-completion-handler branch from f58f4c5 to b2378a4 Compare April 30, 2021 10:56
@ahoppen
Copy link
Member Author

ahoppen commented Apr 30, 2021

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Apr 30, 2021

Windows failures is unrelated.

@ahoppen ahoppen merged commit 36f1c34 into swiftlang:main Apr 30, 2021
@ahoppen ahoppen deleted the pr/convert-completion-handler branch April 30, 2021 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants