File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2401,6 +2401,10 @@ class ConstraintSystem {
24012401 llvm::DenseMap<std::pair<TypeBase *, ProtocolDecl *>, ProtocolConformanceRef>
24022402 Conformances;
24032403
2404+ // / A cache for unavailability checks peformed by the solver.
2405+ llvm::DenseMap<std::pair<const Decl *, ConstraintLocator *>, bool >
2406+ UnavailableDecls;
2407+
24042408 // / The list of all generic requirements fixed along the current
24052409 // / solver path.
24062410 using FixedRequirement =
Original file line number Diff line number Diff line change @@ -4810,13 +4810,20 @@ void ConstraintSystem::diagnoseFailureFor(SyntacticElementTarget target) {
48104810
48114811bool ConstraintSystem::isDeclUnavailable (const Decl *D,
48124812 ConstraintLocator *locator) const {
4813+ auto found = UnavailableDecls.find (std::make_pair (D, locator));
4814+ if (found != UnavailableDecls.end ())
4815+ return found->second ;
4816+
48134817 SourceLoc loc;
48144818 if (locator) {
48154819 if (auto anchor = locator->getAnchor ())
48164820 loc = getLoc (anchor);
48174821 }
48184822
4819- return getUnsatisfiedAvailabilityConstraint (D, DC, loc).has_value ();
4823+ auto result = getUnsatisfiedAvailabilityConstraint (D, DC, loc).has_value ();
4824+ const_cast <ConstraintSystem *>(this )->UnavailableDecls .insert (
4825+ std::make_pair (std::make_pair (D, locator), result));
4826+ return result;
48204827}
48214828
48224829bool ConstraintSystem::isConformanceUnavailable (ProtocolConformanceRef conformance,
You can’t perform that action at this time.
0 commit comments