[CSApply] Allow marker existential to superclass conversions #75628
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.
If existential is a protocol composition type where all of the protocols are
@_marker
, narrowly allow coercion to its superclass bound (if it matches). Both types have the same representation which makes it okay.This is only a problem in Swift 5 mode without strict concurrency checks. In this mode
@preconcurrency
stripping happens outside of the solver which means that no conversion restrictions are recorded for members that got& Sendable
stripped from their types.For example:
Since
member
is@preconcurrency
its type would get concurrency annotations stripped, which includes& Sendable
which means that the solver usesKeyPath<String, Int>
type for the reference and not the originalKeyPath<String, Int> & Sendable
, this is a problem forExprRewritter::adjustTypeForDeclReference
because conversion between existential and its superclass bound requires a constraint restriction which won't be available in this case.Resolves: rdar://132700409