[CSSimplify] Remove diagnostics obsolete diagnostics checks involving CSDiag logic

This commit is contained in:
Luciano Almeida
2020-02-08 12:11:11 -03:00
parent b826b3cc04
commit 5572832368

View File

@@ -3072,23 +3072,16 @@ bool ConstraintSystem::repairFailures(
auto elt = path.back();
switch (elt.getKind()) {
case ConstraintLocator::LValueConversion: {
auto CTP = getContextualTypePurpose(anchor);
// Special case for `CTP_CallArgument` set by CSDiag
// while type-checking each argument because we yet
// to cover argument-to-parameter conversions in the
// new framework.
if (CTP != CTP_CallArgument) {
// Ignore l-value conversion element since it has already
// played its role.
path.pop_back();
// If this is a contextual mismatch between l-value types e.g.
// `@lvalue String vs. @lvalue Int`, let's pretend that it's okay.
if (!path.empty() && path.back().is<LocatorPathElt::ContextualType>()) {
auto *locator = getConstraintLocator(anchor, path.back());
conversionsOrFixes.push_back(
IgnoreContextualType::create(*this, lhs, rhs, locator));
break;
}
// Ignore l-value conversion element since it has already
// played its role.
path.pop_back();
// If this is a contextual mismatch between l-value types e.g.
// `@lvalue String vs. @lvalue Int`, let's pretend that it's okay.
if (!path.empty() && path.back().is<LocatorPathElt::ContextualType>()) {
auto *locator = getConstraintLocator(anchor, path.back());
conversionsOrFixes.push_back(
IgnoreContextualType::create(*this, lhs, rhs, locator));
break;
}
LLVM_FALLTHROUGH;
@@ -3521,13 +3514,6 @@ bool ConstraintSystem::repairFailures(
if (rhs->isExistentialType())
break;
// TODO(diagnostics): This is a problem related to `inout` mismatch,
// in argument position, and we got here from CSDiag. Once
// argument-to-pararameter conversion failures are implemented,
// this check could be removed.
if (lhs->is<InOutType>() || rhs->is<InOutType>())
break;
if (repairViaOptionalUnwrap(*this, lhs, rhs, matchKind, conversionsOrFixes,
locator))
break;