File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -12267,6 +12267,21 @@ bool ConstraintSystem::resolveKeyPath(TypeVariableType *typeVar,
1226712267 Type contextualType,
1226812268 TypeMatchOptions flags,
1226912269 ConstraintLocatorBuilder locator) {
12270+ // Key path types recently gained Copyable, Escapable requirements.
12271+ // The solver cannot account for that during inference because Root
12272+ // and Value types are required to be only resolved enough to infer
12273+ // a capability of a key path itself.
12274+ if (auto *BGT = contextualType->getAs<BoundGenericType>()) {
12275+ auto keyPathTy = openUnboundGenericType(
12276+ BGT->getDecl(), BGT->getParent(), locator, /*isTypeResolution=*/false);
12277+
12278+ assignFixedType(
12279+ typeVar, keyPathTy, /*updateState=*/true,
12280+ /*notifyInference=*/!flags.contains(TMF_BindingTypeVariable));
12281+ addConstraint(ConstraintKind::Equal, keyPathTy, contextualType, locator);
12282+ return true;
12283+ }
12284+
1227012285 assignFixedType(typeVar, contextualType, /*updateState=*/true,
1227112286 /*notifyInference=*/!flags.contains(TMF_BindingTypeVariable));
1227212287 return true;
You can’t perform that action at this time.
0 commit comments