[ConstraintSystem] Stop using CheckedConformances cache

It was necessary only for `applySolutionToForEachStmt` in `CSApply`,
diagnostic can avoid it and use information stored in the locator
instead.
This commit is contained in:
Pavel Yaskevich
2021-01-08 11:36:28 -08:00
parent 114364873d
commit 87cc597d19
2 changed files with 7 additions and 12 deletions

View File

@@ -5721,18 +5721,17 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
/// Record the given conformance as the result, adding any conditional
/// requirements if necessary.
auto recordConformance = [&](ProtocolConformanceRef conformance) {
auto *conformanceLoc = getConstraintLocator(
loc, LocatorPathElt::ConformanceRequirement(protocol));
// Record the conformance.
CheckedConformances.push_back({conformanceLoc, conformance});
if (isConformanceUnavailable(conformance, conformanceLoc))
if (isConformanceUnavailable(conformance, loc))
increaseScore(SK_Unavailable);
// This conformance may be conditional, in which case we need to consider
// those requirements as constraints too.
if (conformance.isConcrete()) {
unsigned index = 0;
auto *conformanceLoc = getConstraintLocator(
loc,
LocatorPathElt::ConformanceRequirement(conformance.getConcrete()));
for (const auto &req : conformance.getConditionalRequirements()) {
addConstraint(
req, getConstraintLocator(conformanceLoc,