Skip to content

Commit 3604551

Browse files
author
Amritpan Kaur
committed
[CSSimplify] Handle keypathvalue constraint locator
1 parent 36031f3 commit 3604551

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,6 +6605,22 @@ bool ConstraintSystem::repairFailures(
66056605
conversionsOrFixes.push_back(fix);
66066606
return true;
66076607
}
6608+
case ConstraintLocator::KeyPathValue: {
6609+
if (lhs->isPlaceholder() || rhs->isPlaceholder())
6610+
return true;
6611+
if (lhs->isTypeVariableOrMember() || rhs->isTypeVariableOrMember())
6612+
break;
6613+
6614+
auto kpExpr = castToExpr<KeyPathExpr>(anchor);
6615+
auto i = kpExpr->getComponents().size() - 1;
6616+
auto lastCompLoc =
6617+
getConstraintLocator(kpExpr, LocatorPathElt::KeyPathComponent(i));
6618+
if (hasFixFor(lastCompLoc, FixKind::AllowTypeOrInstanceMember))
6619+
return true;
6620+
6621+
conversionsOrFixes.push_back(IgnoreContextualType::create(
6622+
*this, lhs, rhs, getConstraintLocator(anchor)));
6623+
}
66086624
default:
66096625
break;
66106626
}

0 commit comments

Comments
 (0)