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,
12267
12267
Type contextualType,
12268
12268
TypeMatchOptions flags,
12269
12269
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
+
12270
12285
assignFixedType(typeVar, contextualType, /*updateState=*/true,
12271
12286
/*notifyInference=*/!flags.contains(TMF_BindingTypeVariable));
12272
12287
return true;
You can’t perform that action at this time.
0 commit comments