[Diagnostics] Port implicitly escaping to type conversion diagnostics to new abstraction

This commit is contained in:
Pavel Yaskevich
2018-08-09 11:02:45 -07:00
parent d30aa32001
commit 157dc719e0
3 changed files with 42 additions and 18 deletions

View File

@@ -8000,27 +8000,14 @@ bool ConstraintSystem::applySolutionFix(
}
case FixKind::ExplicitlyEscaping: {
auto path = locator->getPath();
auto *anchor = locator->getAnchor();
if (path.empty())
return false;
auto &last = path.back();
if (last.getKind() == ConstraintLocator::Archetype) {
auto *archetype = last.getArchetype();
TC.diagnose(anchor->getLoc(), diag::converting_noescape_to_type,
archetype);
return true;
}
break;
NoEscapeFuncToTypeConversionFailure failure(expr, solution, locator);
return failure.diagnose();
}
case FixKind::ExplicitlyEscapingToAny: {
auto *anchor = locator->getAnchor();
TC.diagnose(anchor->getLoc(), diag::converting_noescape_to_type,
getASTContext().TheAnyType);
return true;
NoEscapeFuncToTypeConversionFailure failure(expr, solution, locator,
getASTContext().TheAnyType);
return failure.diagnose();
}
case FixKind::RelabelArguments: {