Skip to content

Commit df47d1b

Browse files
committed
[ContraintSystem] Don't de-duplicate generic requirements
Looks like this is not really needed since fixed requirements cache can handle such de-duplication.
1 parent cbadd7f commit df47d1b

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,6 @@ void ConstraintSystem::mergeEquivalenceClasses(TypeVariableType *typeVar1,
126126
// Merge nodes in the constraint graph.
127127
CG.mergeNodes(typeVar1, typeVar2);
128128

129-
// Let's try to de-duplicate any generic requirements
130-
// associated with given type variable, if it represents
131-
// a generic parameter.
132-
if (typeVar1->getImpl().getGenericParameter()) {
133-
auto requirements = CG.gatherConstraints(
134-
typeVar1, ConstraintGraph::GatheringKind::EquivalenceClass,
135-
[](Constraint *constraint) -> bool {
136-
if (auto *locator = constraint->getLocator()) {
137-
return locator->isLastElement(
138-
ConstraintLocator::TypeParameterRequirement) ||
139-
locator->isLastElement(
140-
ConstraintLocator::ConditionalRequirement);
141-
}
142-
143-
return false;
144-
});
145-
146-
llvm::SmallPtrSet<TypeBase *, 4> existingRequirements;
147-
for (auto *req : requirements) {
148-
auto constraintTy = req->getSecondType();
149-
// If this constraint has already been recorded in the
150-
// constraint system, there is no reason to check it twice.
151-
if (!existingRequirements.insert(constraintTy.getPointer()).second)
152-
retireConstraint(req);
153-
}
154-
}
155-
156129
if (updateWorkList) {
157130
addTypeVariableConstraintsToWorkList(typeVar1);
158131
}

lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,6 @@ class Solution {
637637
/// The list of member references which couldn't be resolved,
638638
/// and had to be assumed based on their use.
639639
llvm::SmallVector<ConstraintLocator *, 4> MissingMembers;
640-
llvm::SmallVector<std::pair<GenericSignature *, unsigned>, 4>
641-
FixedRequirements;
642640

643641
/// The set of disjunction choices used to arrive at this solution,
644642
/// which informs constraint application.

0 commit comments

Comments
 (0)