mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSolver] Handle situations when key path expression has an existential type
A way to mark key path as Sendable is to extend its type with `& Sendable`. This is something that makes the type of a key path expression an existential with superclass bound expressed as a known key path type.
This commit is contained in:
@@ -12195,6 +12195,12 @@ ConstraintSystem::simplifyKeyPathConstraint(
|
||||
if (contextualTy->isPlaceholder())
|
||||
return true;
|
||||
|
||||
// Situations like `any KeyPath<...> & Sendable`.
|
||||
if (contextualTy->isExistentialType()) {
|
||||
contextualTy = contextualTy->getExistentialLayout().explicitSuperclass;
|
||||
assert(contextualTy);
|
||||
}
|
||||
|
||||
// If there are no other options the solver might end up picking
|
||||
// `AnyKeyPath` or `PartialKeyPath` based on a contextual conversion.
|
||||
// This is an error during normal type-checking but okay in
|
||||
|
||||
Reference in New Issue
Block a user