@@ -47,6 +47,22 @@ static bool hasConversions(Type);
4747static std::optional<Type> checkTypeOfBinding (TypeVariableType *typeVar,
4848 Type type);
4949
50+ BindingSet::BindingSet (ConstraintSystem &CS, TypeVariableType *TypeVar,
51+ const PotentialBindings &info)
52+ : CS(CS), TypeVar(TypeVar), Info(info) {
53+ for (const auto &binding : info.Bindings )
54+ addBinding (binding, /* isTransitive=*/ false );
55+
56+ for (auto *literal : info.Literals )
57+ addLiteralRequirement (literal);
58+
59+ for (auto *constraint : info.Defaults )
60+ addDefault (constraint);
61+
62+ for (auto &entry : info.AdjacentVars )
63+ AdjacentVars.insert (entry.first );
64+ }
65+
5066bool BindingSet::forClosureResult () const {
5167 return TypeVar->getImpl ().isClosureResultType ();
5268}
@@ -1884,7 +1900,7 @@ PotentialBindings::inferFromRelational(ConstraintSystem &CS,
18841900void PotentialBindings::infer (ConstraintSystem &CS,
18851901 TypeVariableType *TypeVar,
18861902 Constraint *constraint) {
1887- if (!Constraints.insert (constraint). second )
1903+ if (!Constraints.insert (constraint))
18881904 return ;
18891905
18901906 // Record the change, if there are active scopes.
@@ -2059,7 +2075,7 @@ void PotentialBindings::infer(ConstraintSystem &CS,
20592075void PotentialBindings::retract (ConstraintSystem &CS,
20602076 TypeVariableType *TypeVar,
20612077 Constraint *constraint) {
2062- if (!Constraints.erase (constraint))
2078+ if (!Constraints.remove (constraint))
20632079 return ;
20642080
20652081 // Record the change, if there are active scopes.
0 commit comments