Skip to content

[6.2] SILGen: Emit property descriptors for conditionally Copyable and Escapable types. #81796

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

Conversation

jckarter
Copy link
Contributor

Explanation: Fixes an ABI oversight where we would neglect to emit key path property descriptors for declarations that are conditionally Copyable, while also suppressing the attempt to emit key path property descriptors for types that are not Escapable, since KeyPath requires Escapable types, and our codegen would trigger unwanted lifetime errors in implicitly-generated key path thunks.

Scope: Bug fix.

Issue: rdar://151628396.

Original PR: #81617

Risk: Low. Changes the conditions under which key path property descriptors are emitted, but doesn't affect their code generation or behavior.

Testing: Swift CI, test case from bug report

Reviewer: @slavapestov

…pable types.

Key paths can't reference non-escapable or non-copyable storage declarations,
so we don't need to refer to them resiliently, and can elide their property
descriptors.

However, declarations may still be conditionally Copyable and Escapable, and
if so, then they still need a property descriptor for resilient key path
references. When a property or subscript can be used in a context where it
is fully Copyable and Escapable, emit the property descriptor in a generic
environment constrained by the necessary conditional constraints.

Fixes rdar://151628396.
@jckarter jckarter requested a review from a team as a code owner May 28, 2025 03:35
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter jckarter merged commit ad12b78 into swiftlang:release/6.2 May 29, 2025
5 checks passed
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.

3 participants