Merge pull request #78377 from hamishknight/no-simplify-result

[CS] Don't simplify `FunctionResult` in `simplifyLocator`
This commit is contained in:
Hamish Knight
2025-01-02 17:26:22 +00:00
committed by GitHub
7 changed files with 32 additions and 88 deletions

View File

@@ -5180,11 +5180,16 @@ bool ConstraintSystem::repairFailures(
// side isn't, let's check it would be possible to fix
// this by forming an explicit call.
auto convertTo = dstType->lookThroughAllOptionalTypes();
// Right-hand side can't be - a function, a type variable or dependent
// member, or `Any` (if function conversion to `Any` didn't succeed there
// is something else going on e.g. problem with escapiness).
if (convertTo->is<FunctionType>() || convertTo->isTypeVariableOrMember() ||
convertTo->isAny())
// If the RHS is a function type, the source must be a function-returning
// function.
if (convertTo->is<FunctionType>() && !resultType->is<FunctionType>())
return false;
// Right-hand side can't be a type variable or dependent member, or `Any`
// (if function conversion to `Any` didn't succeed there is something else
// going on e.g. problem with escapiness).
if (convertTo->isTypeVariableOrMember() || convertTo->isAny())
return false;
ConstraintKind matchKind;
@@ -15243,12 +15248,6 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
return result;
}
case FixKind::AutoClosureForwarding: {
if (recordFix(fix))
return SolutionKind::Error;
return matchTypes(type1, type2, matchKind, subflags, locator);
}
case FixKind::AllowTupleTypeMismatch: {
if (fix->getAs<AllowTupleTypeMismatch>()->isElementMismatch()) {
auto *locator = fix->getLocator();