Skip to content

Conversation

@bnbarham
Copy link
Contributor

Instead of a new attribute @completionHandlerAsync, allow the use of
the existing renamed parameter of @available to specify the
asynchronous alternative of a synchronous function.

No errors will be output from invalid names as @completionHandlerAsync
had, but if a function is correctly matched then it will be used to
output warnings when using the synchronous function in an asynchronous
context (as before).

Resolves rdar://80612731

@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

Few main changes from the commit in the other PR:

  • No Decl::getRenamedDecl, it only makes sense in the context of a particular attribute
  • getAsyncAlternative uses the first-in-source @available that has no platform and a renamed, or the first with a renamed otherwise (regardless of platform)
  • findPotentialCompletionHandlerParam ignores default parameters in the async function if the argument labels don't match. Added a bunch of tests for that case

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 87648a0e7118a851ce5c8265c2250966e7d858f8

@bnbarham bnbarham force-pushed the available-not-completionhandlerasync branch from 87648a0 to 1b4e614 Compare July 27, 2021 09:10
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows platform

Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@bnbarham bnbarham force-pushed the available-not-completionhandlerasync branch from 1b4e614 to b79fd11 Compare July 28, 2021 00:44
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1b4e614e92a6374eb62e38ec04a3dd2f448c7525

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 1b4e614e92a6374eb62e38ec04a3dd2f448c7525

@bnbarham bnbarham force-pushed the available-not-completionhandlerasync branch from b79fd11 to d793390 Compare July 28, 2021 01:11
@bnbarham
Copy link
Contributor Author

@swift-ci please test

Instead of a new attribute `@completionHandlerAsync`, allow the use of
the existing `renamed` parameter of `@available` to specify the
asynchronous alternative of a synchronous function.

No errors will be output from invalid names as `@completionHandlerAsync`
had, but if a function is correctly matched then it will be used to
output warnings when using the synchronous function in an asynchronous
context (as before).

Resolves rdar://80612731
@bnbarham bnbarham force-pushed the available-not-completionhandlerasync branch from d793390 to e7e9b57 Compare July 28, 2021 23:15
@bnbarham
Copy link
Contributor Author

Ah, someone else got module format version number change in before I could merge. Ah well. Last tests passed, will just do a smoke test so I can merge.

@swift-ci smoke test

@bnbarham
Copy link
Contributor Author

@etcwilde I'm going to merge this, but let me know if you think it needs any changes.

@bnbarham bnbarham merged commit 7bee60e into main Jul 29, 2021
@bnbarham bnbarham deleted the available-not-completionhandlerasync branch July 29, 2021 03:36
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.

4 participants