Skip to content

[Refactoring] Support refactoring to async if callback is @convention(block) #37071

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 28, 2021

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Apr 26, 2021

We already have special logic to extract the closure for closures with capture lists. Add the same kind of logic for closures that are marked @convention(block) etc.

Resolves rdar://75301524 [SR-14328]

@ahoppen ahoppen requested a review from bnbarham April 26, 2021 22:05
@ahoppen
Copy link
Member Author

ahoppen commented Apr 26, 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 :)

// BLOCK-CONVENTION: func blockConvention() async { }

// RUN: %refactor -add-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix C-CONVENTION %s
func cConvention(completion: @convention(block) () -> Void) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to be @convention(c)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, that was what I was trying to test.

…n(block)`

We already have special logic to extrac the closure for closures with capture lists, add the same kind of logic for closures that are marked `@convention(block)` etc.

Resolves rdar://75301524 [SR-14328]
@ahoppen ahoppen force-pushed the pr/block-convention-to-async branch from 3615a31 to f17fe86 Compare April 27, 2021 20:26
@ahoppen
Copy link
Member Author

ahoppen commented Apr 27, 2021

@swift-ci Please test

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