mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSSimplify] NFC: Perform assignments to a key path in a separate method
Previously key path type didn't have any requirements on their root and value types but now that they do, we need a dedicated place to perform an assignment and open/record all of the requirements.
This commit is contained in:
@@ -4675,6 +4675,12 @@ ConstraintSystem::matchTypesBindTypeVar(
|
||||
: getTypeMatchFailure(locator);
|
||||
}
|
||||
|
||||
if (typeVar->getImpl().isKeyPathType()) {
|
||||
return resolveKeyPath(typeVar, type, flags, locator)
|
||||
? getTypeMatchSuccess()
|
||||
: getTypeMatchFailure(locator);
|
||||
}
|
||||
|
||||
assignFixedType(typeVar, type, /*updateState=*/true,
|
||||
/*notifyInference=*/!flags.contains(TMF_BindingTypeVariable));
|
||||
|
||||
@@ -12257,6 +12263,15 @@ bool ConstraintSystem::resolveTapBody(TypeVariableType *typeVar,
|
||||
return !generateConstraints(tapExpr);
|
||||
}
|
||||
|
||||
bool ConstraintSystem::resolveKeyPath(TypeVariableType *typeVar,
|
||||
Type contextualType,
|
||||
TypeMatchOptions flags,
|
||||
ConstraintLocatorBuilder locator) {
|
||||
assignFixedType(typeVar, contextualType, /*updateState=*/true,
|
||||
/*notifyInference=*/!flags.contains(TMF_BindingTypeVariable));
|
||||
return true;
|
||||
}
|
||||
|
||||
ConstraintSystem::SolutionKind
|
||||
ConstraintSystem::simplifyDynamicTypeOfConstraint(
|
||||
Type type1, Type type2,
|
||||
|
||||
Reference in New Issue
Block a user