Skip to content

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Apr 17, 2025

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 via read and modify.

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 )

In preparation for a recursive call and an additional private parameter.
If an overridden decl requires an underscored accessor, then the derived
decl requires one too.  Otherwise dispatch to a less-derived instance
could bind to the underscored accessor which lacks an override.

rdar://149352777
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review April 17, 2025 22:19
@nate-chandler nate-chandler requested a review from a team as a code owner April 17, 2025 22:19
@nate-chandler nate-chandler enabled auto-merge April 17, 2025 22:19
auto-merge was automatically disabled April 24, 2025 21:49

Pull request was closed

@nate-chandler nate-chandler deleted the cherrypick/release/6.2/rdar149352777 branch April 24, 2025 22:23
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