6.2: [CoroutineAccessors] Require underscored override. #80891
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation: Emit
_read
and_modify
for storage which overrides storage which defines them.When storage's availability is new enough,
_read
and_modify
functions are omitted. For example, a subscript which became available after the CoroutineAccessors feature will typically not need such functions--all accesses will be done viaread
andmodify
.If (1) the storage for which accessors are being emitted overrides storage on a superclass in a different resilient module and (2) that superclass' has been available since before the feature became available, however, omitting those functions (and omitting their entries from the subclass' vtable) was incorrect. The problem is that even if the subclass is only ever used in an availability context newer than the feature, it may still call a function (e.g. an
@inlinable
function must access the superclass' storage via_read
and_modify
because the function could be inlined into another module's function whose availability is lower than the availability of the feature) which uses_read
and_modify
.Previously, whether
_read
and_modify
were required by overridden storage was not considered. Here, that is checked.Scope: Affect coroutine accessors.
Issue: rdar://149352777
Original PR: #80889
Risk: Low, only affects coroutine accessors.
Testing: Added tests.
Reviewer: Joe Groff ( @jckarter )