@@ -3577,6 +3577,12 @@ bool ConstraintSystem::repairFailures(
3577
3577
break ;
3578
3578
}
3579
3579
3580
+ case ConstraintLocator::KeyPathRoot:
3581
+ conversionsOrFixes.push_back (AllowKeyPathRootTypeMismatch::create (
3582
+ *this , lhs, rhs, getConstraintLocator (locator)));
3583
+
3584
+ break ;
3585
+
3580
3586
case ConstraintLocator::FunctionArgument: {
3581
3587
auto *argLoc = getConstraintLocator (
3582
3588
locator.withPathElement (LocatorPathElt::SynthesizedArgument (0 )));
@@ -7829,8 +7835,9 @@ ConstraintSystem::simplifyKeyPathApplicationConstraint(
7829
7835
rootTy = getFixedTypeRecursive (rootTy, flags, /* wantRValue=*/ false );
7830
7836
7831
7837
auto matchRoot = [&](ConstraintKind kind) -> bool {
7832
- auto rootMatches = matchTypes (rootTy, kpRootTy, kind,
7833
- subflags, locator);
7838
+ auto rootMatches =
7839
+ matchTypes (rootTy, kpRootTy, kind, subflags,
7840
+ locator.withPathElement (LocatorPathElt::KeyPathRoot ()));
7834
7841
switch (rootMatches) {
7835
7842
case SolutionKind::Error:
7836
7843
return false ;
@@ -9392,6 +9399,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
9392
9399
case FixKind::SpecifyBaseTypeForContextualMember:
9393
9400
case FixKind::CoerceToCheckedCast:
9394
9401
case FixKind::SpecifyObjectLiteralTypeImport:
9402
+ case FixKind::AllowKeyPathRootTypeMismatch:
9395
9403
case FixKind::AllowCoercionToForceCast: {
9396
9404
return recordFix (fix) ? SolutionKind::Error : SolutionKind::Solved;
9397
9405
}
0 commit comments