Merge pull request #74564 from gottesmm/pr-9be87019f95149167c2e03043b7a86b82f9d282c

Follow up fixes with feedback from #74129
This commit is contained in:
Michael Gottesman
2024-06-25 10:24:26 -07:00
committed by GitHub
5 changed files with 38 additions and 66 deletions

View File

@@ -3239,9 +3239,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
// () -> sending T can be a subtype of () -> T... but not vis-a-versa.
if (func1->hasSendingResult() != func2->hasSendingResult() &&
(!func1->hasSendingResult() || kind < ConstraintKind::Subtype)) {
auto *fix = AllowSendingMismatch::create(
*this, getConstraintLocator(locator), func1, func2,
AllowSendingMismatch::Kind::Result);
auto *fix = AllowSendingMismatch::create(*this, func1, func2,
getConstraintLocator(locator));
if (recordFix(fix))
return getTypeMatchFailure(locator);
}
@@ -3681,8 +3680,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
if (func1Param.getParameterFlags().isSending() &&
!func2Param.getParameterFlags().isSending()) {
auto *fix = AllowSendingMismatch::create(
*this, getConstraintLocator(argumentLocator), func1, func2,
AllowSendingMismatch::Kind::Parameter);
*this, func1, func2, getConstraintLocator(argumentLocator));
if (recordFix(fix))
return getTypeMatchFailure(argumentLocator);
}