Merge pull request #38235 from xedin/rdar-79757320

[Diagnostics] Ignore result type failures if one side is a hole
This commit is contained in:
Pavel Yaskevich
2021-07-06 13:52:07 -07:00
committed by GitHub
3 changed files with 37 additions and 2 deletions

View File

@@ -4286,8 +4286,7 @@ bool ConstraintSystem::repairFailures(
// it's going to be diagnosed by specialized fix which deals
// with generic argument mismatches.
if (matchKind == ConstraintKind::BindToPointerType) {
auto *member = rhs->getAs<DependentMemberType>();
if (!(member && member->getBase()->hasPlaceholder()))
if (!rhs->isPlaceholder())
break;
}
@@ -4634,6 +4633,12 @@ bool ConstraintSystem::repairFailures(
}
case ConstraintLocator::FunctionResult: {
if (lhs->isPlaceholder() || rhs->isPlaceholder()) {
recordAnyTypeVarAsPotentialHole(lhs);
recordAnyTypeVarAsPotentialHole(rhs);
return true;
}
auto *loc = getConstraintLocator(anchor, {path.begin(), path.end() - 1});
// If this is a mismatch between contextual type and (trailing)
// closure with explicitly specified result type let's record it
@@ -4654,6 +4659,7 @@ bool ConstraintSystem::repairFailures(
break;
}
}
// Handle function result coerce expression wrong type conversion.
if (isExpr<CoerceExpr>(anchor)) {
auto *fix =