File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,9 @@ struct PotentialBindings {
223223
224224 TypeVariableType *TypeVar;
225225
226+ // / The set of all constraints that have been added via infer().
227+ llvm::SmallPtrSet<Constraint *, 2 > Constraints;
228+
226229 // / The set of potential bindings.
227230 llvm::SmallVector<PotentialBinding, 4 > Bindings;
228231
Original file line number Diff line number Diff line change @@ -1769,6 +1769,9 @@ PotentialBindings::inferFromRelational(Constraint *constraint) {
17691769// / representative type variable, along with flags indicating whether
17701770// / those types should be opened.
17711771void PotentialBindings::infer (Constraint *constraint) {
1772+ if (!Constraints.insert (constraint).second )
1773+ return ;
1774+
17721775 switch (constraint->getKind ()) {
17731776 case ConstraintKind::Bind:
17741777 case ConstraintKind::Equal:
@@ -1937,6 +1940,9 @@ void PotentialBindings::infer(Constraint *constraint) {
19371940}
19381941
19391942void PotentialBindings::retract (Constraint *constraint) {
1943+ if (!Constraints.erase (constraint))
1944+ return ;
1945+
19401946 Bindings.erase (
19411947 llvm::remove_if (Bindings,
19421948 [&constraint](const PotentialBinding &binding) {
You can’t perform that action at this time.
0 commit comments