@@ -47,6 +47,22 @@ static bool hasConversions(Type);
47
47
static std::optional<Type> checkTypeOfBinding (TypeVariableType *typeVar,
48
48
Type type);
49
49
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
+
50
66
bool BindingSet::forClosureResult () const {
51
67
return TypeVar->getImpl ().isClosureResultType ();
52
68
}
@@ -1884,7 +1900,7 @@ PotentialBindings::inferFromRelational(ConstraintSystem &CS,
1884
1900
void PotentialBindings::infer (ConstraintSystem &CS,
1885
1901
TypeVariableType *TypeVar,
1886
1902
Constraint *constraint) {
1887
- if (!Constraints.insert (constraint). second )
1903
+ if (!Constraints.insert (constraint))
1888
1904
return ;
1889
1905
1890
1906
// Record the change, if there are active scopes.
@@ -2059,7 +2075,7 @@ void PotentialBindings::infer(ConstraintSystem &CS,
2059
2075
void PotentialBindings::retract (ConstraintSystem &CS,
2060
2076
TypeVariableType *TypeVar,
2061
2077
Constraint *constraint) {
2062
- if (!Constraints.erase (constraint))
2078
+ if (!Constraints.remove (constraint))
2063
2079
return ;
2064
2080
2065
2081
// Record the change, if there are active scopes.
0 commit comments