mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSimplify] Recording fix for keypath application root type mismatch
This commit is contained in:
@@ -3577,6 +3577,12 @@ bool ConstraintSystem::repairFailures(
|
||||
break;
|
||||
}
|
||||
|
||||
case ConstraintLocator::KeyPathRoot:
|
||||
conversionsOrFixes.push_back(AllowKeyPathRootTypeMismatch::create(
|
||||
*this, lhs, rhs, getConstraintLocator(locator)));
|
||||
|
||||
break;
|
||||
|
||||
case ConstraintLocator::FunctionArgument: {
|
||||
auto *argLoc = getConstraintLocator(
|
||||
locator.withPathElement(LocatorPathElt::SynthesizedArgument(0)));
|
||||
@@ -7829,8 +7835,9 @@ ConstraintSystem::simplifyKeyPathApplicationConstraint(
|
||||
rootTy = getFixedTypeRecursive(rootTy, flags, /*wantRValue=*/false);
|
||||
|
||||
auto matchRoot = [&](ConstraintKind kind) -> bool {
|
||||
auto rootMatches = matchTypes(rootTy, kpRootTy, kind,
|
||||
subflags, locator);
|
||||
auto rootMatches =
|
||||
matchTypes(rootTy, kpRootTy, kind, subflags,
|
||||
locator.withPathElement(LocatorPathElt::KeyPathRoot()));
|
||||
switch (rootMatches) {
|
||||
case SolutionKind::Error:
|
||||
return false;
|
||||
@@ -9392,6 +9399,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
|
||||
case FixKind::SpecifyBaseTypeForContextualMember:
|
||||
case FixKind::CoerceToCheckedCast:
|
||||
case FixKind::SpecifyObjectLiteralTypeImport:
|
||||
case FixKind::AllowKeyPathRootTypeMismatch:
|
||||
case FixKind::AllowCoercionToForceCast: {
|
||||
return recordFix(fix) ? SolutionKind::Error : SolutionKind::Solved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user