Skip to content

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Sep 24, 2025

Accessor availability diagnostics for key path expressions were first introduced by #83931. Those changes were insufficient because sometimes key path expressions are generated in the AST with more mutability than is needed by the context and so setter availability could be diagnosed inappropriately. Key path expression binding was refined in #84491 to make this less likely to occur. However, there are still some circumstances in which a mutable key path is generated in the AST and then immediately coerced into an immutable key path to satisfy the contextual type. This change infers the immutability of these key path expressions by looking through surrounding conversion expressions.

@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli tshortli force-pushed the expr-availability-key-path-mutability-in-conversions branch from b8c8786 to 2f924dc Compare September 25, 2025 00:41
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli marked this pull request as ready for review September 25, 2025 00:44
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli
Copy link
Contributor Author

@swift-ci please test macOS

@tshortli
Copy link
Contributor Author

@swift-ci please test Windows

…king.

Accessor availability diagnostics for key path expressions were first
introduced by swiftlang#83931. Those changes were
insufficient because sometimes key path expressions are generated in the AST
with more mutability than is needed by the context and so setter availability
could be diagnosed inappropriately. Key path expression binding was refined in
swiftlang#84491 to make this less likely to
occur. However, there are still some circumstances in which a mutable key path
is generated in the AST and then immediately coerced into an immutable key path
to satisfy the contextual type. This change infers the immutability of these key
path expressions by looking through surrounding conversion expressions.
@tshortli tshortli force-pushed the expr-availability-key-path-mutability-in-conversions branch from 2f924dc to ee988c0 Compare September 25, 2025 14:18
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 7092053 into swiftlang:main Sep 25, 2025
5 checks passed
@tshortli tshortli deleted the expr-availability-key-path-mutability-in-conversions branch September 25, 2025 23:25
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