Skip to content

[CoroutineAccessors] Synthesize default requirement implementations. #77429

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 11 commits into from
Nov 10, 2024

Conversation

nate-chandler
Copy link
Contributor

When a protocol which has a read (or modify) requirement is built with the CoroutineAccessors feature, it gains a read2 (or modify2, respectively) requirement. For this to be compatible with binaries built without the feature, a default implementation for these new requirements must be provided. Cause these new accessor requirements to have default implementations by returning true from doesAccessorHaveBody when the context is a ProtocolDecl and the relevant availability check passes.

@nate-chandler nate-chandler force-pushed the general-coro/20241104/1 branch from de7af46 to 0254b74 Compare November 6, 2024 21:25
The variable `storage` was defined as `nullptr` a couple lines above and
then is check for null, a spurious check.  Eliminate that
nullcheck--it's always true.
Move the bailout from getSynthesizedAccessor from the wrapper function
into the evaluate body.  Will enable the request to do work on
non-synthesized accessors, which is required to provide a default
implementation for modify2 and read2 members.
@nate-chandler nate-chandler force-pushed the general-coro/20241104/1 branch 2 times, most recently from 8f4cf1b to 03e1601 Compare November 7, 2024 22:38
When a protocol which has a read (or modify) requirement is built with
the CoroutineAccessors feature, it gains a read2 (or modify2,
respectively) requirement.  For this to be compatible with binaries
built without the feature, a default implementation for these new
requirements must be provided.  Cause these new accessor requirements to
have default implementations by returning `true` from
`doesAccessorHaveBody` when the context is a `ProtocolDecl` and the
relevant availability check passes.
@nate-chandler nate-chandler force-pushed the general-coro/20241104/1 branch from 03e1601 to da71271 Compare November 8, 2024 00:47
Don't iterate users while deleting them.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please test source compatibility

@nate-chandler
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@nate-chandler nate-chandler marked this pull request as ready for review November 9, 2024 18:34
@nate-chandler nate-chandler merged commit aab880d into swiftlang:main Nov 10, 2024
6 of 8 checks passed
@nate-chandler nate-chandler deleted the general-coro/20241104/1 branch November 10, 2024 15:43
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.

1 participant