Skip to content

Commit e17a934

Browse files
[CSSimplify] Recording fix for keypath application root type mismatch
1 parent f18fe09 commit e17a934

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3577,6 +3577,12 @@ bool ConstraintSystem::repairFailures(
35773577
break;
35783578
}
35793579

3580+
case ConstraintLocator::KeyPathRoot:
3581+
conversionsOrFixes.push_back(AllowKeyPathRootTypeMismatch::create(
3582+
*this, lhs, rhs, getConstraintLocator(locator)));
3583+
3584+
break;
3585+
35803586
case ConstraintLocator::FunctionArgument: {
35813587
auto *argLoc = getConstraintLocator(
35823588
locator.withPathElement(LocatorPathElt::SynthesizedArgument(0)));
@@ -7829,8 +7835,9 @@ ConstraintSystem::simplifyKeyPathApplicationConstraint(
78297835
rootTy = getFixedTypeRecursive(rootTy, flags, /*wantRValue=*/false);
78307836

78317837
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()));
78347841
switch (rootMatches) {
78357842
case SolutionKind::Error:
78367843
return false;
@@ -9392,6 +9399,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
93929399
case FixKind::SpecifyBaseTypeForContextualMember:
93939400
case FixKind::CoerceToCheckedCast:
93949401
case FixKind::SpecifyObjectLiteralTypeImport:
9402+
case FixKind::AllowKeyPathRootTypeMismatch:
93959403
case FixKind::AllowCoercionToForceCast: {
93969404
return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved;
93979405
}

0 commit comments

Comments
 (0)