swift
eeffdef2 - [CSApply] Allow marker existential to superclass conversions

Commit
1 year ago
[CSApply] Allow marker existential to superclass conversions 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: ```swift struct S { @preconcurrency static let member: KeyPath<String, Int> & Sendable } func test() { _ = S.member } ``` Since `member` is `@preconcurrency` its type would get concurrency annotations stripped, which includes `& Sendable` which means that the solver uses `KeyPath<String, Int>` type for the reference and not the original `KeyPath<String, Int> & Sendable`, this is a problem for `ExprRewritter::adjustTypeForDeclReference` because conversion between existential and its superclass bound requires a constraint restriction which won't be available in this case. Resolves: rdar://132700409 (cherry picked from commit 38aa71de91e31c9d0ed16d93db76c09b25c1ae8d)
Author
Committer
Parents
Loading