@@ -50,24 +50,26 @@ static std::optional<Type> checkTypeOfBinding(TypeVariableType *typeVar,
50
50
BindingSet::BindingSet (ConstraintSystem &CS, TypeVariableType *TypeVar,
51
51
const PotentialBindings &info)
52
52
: CS(CS), TypeVar(TypeVar), Info(info) {
53
+
53
54
for (const auto &binding : info.Bindings )
54
55
addBinding (binding, /* isTransitive=*/ false );
55
56
56
57
for (auto *constraint : info.Constraints ) {
57
58
switch (constraint->getKind ()) {
58
- case ConstraintKind::ConformsTo: {
59
+ case ConstraintKind::ConformsTo:
59
60
if (constraint->getSecondType ()->is <ProtocolType>())
60
61
Protocols.push_back (constraint);
61
62
break ;
62
- }
63
+
64
+ case ConstraintKind::LiteralConformsTo:
65
+ addLiteralRequirement (constraint);
66
+ break ;
67
+
63
68
default :
64
69
break ;
65
70
}
66
71
}
67
72
68
- for (auto *literal : info.Literals )
69
- addLiteralRequirement (literal);
70
-
71
73
for (auto *constraint : info.Defaults )
72
74
addDefault (constraint);
73
75
@@ -1311,10 +1313,6 @@ void PotentialBindings::addPotentialBinding(TypeVariableType *TypeVar,
1311
1313
Bindings.push_back (std::move (binding));
1312
1314
}
1313
1315
1314
- void PotentialBindings::addLiteral (Constraint *constraint) {
1315
- Literals.insert (constraint);
1316
- }
1317
-
1318
1316
bool BindingSet::isViable (PotentialBinding &binding, bool isTransitive) {
1319
1317
// Prevent against checking against the same opened nominal type
1320
1318
// over and over again. Doing so means redundant work in the best
@@ -1969,6 +1967,7 @@ void PotentialBindings::infer(ConstraintSystem &CS,
1969
1967
case ConstraintKind::SameShape:
1970
1968
case ConstraintKind::MaterializePackExpansion:
1971
1969
case ConstraintKind::ConformsTo:
1970
+ case ConstraintKind::LiteralConformsTo:
1972
1971
// Constraints from which we can't do anything.
1973
1972
break ;
1974
1973
@@ -2009,13 +2008,6 @@ void PotentialBindings::infer(ConstraintSystem &CS,
2009
2008
DelayedBy.push_back (constraint);
2010
2009
break ;
2011
2010
2012
- case ConstraintKind::LiteralConformsTo: {
2013
- // Record constraint where protocol requirement originated
2014
- // this is useful to use for the binding later.
2015
- addLiteral (constraint);
2016
- break ;
2017
- }
2018
-
2019
2011
case ConstraintKind::ApplicableFunction:
2020
2012
case ConstraintKind::DynamicCallableApplicableFunction: {
2021
2013
auto overloadTy = constraint->getSecondType ();
@@ -2090,7 +2082,6 @@ void PotentialBindings::retract(ConstraintSystem &CS,
2090
2082
2091
2083
LLVM_DEBUG (
2092
2084
llvm::dbgs () << Constraints.size () << " " << Bindings.size () << " "
2093
- << Literals.size () << " "
2094
2085
<< AdjacentVars.size () << " " << DelayedBy.size () << " "
2095
2086
<< SubtypeOf.size () << " " << SupertypeOf.size () << " "
2096
2087
<< EquivalentTo.size () << " \n " );
@@ -2103,10 +2094,6 @@ void PotentialBindings::retract(ConstraintSystem &CS,
2103
2094
Bindings.end ());
2104
2095
2105
2096
switch (constraint->getKind ()) {
2106
- case ConstraintKind::LiteralConformsTo:
2107
- Literals.erase (constraint);
2108
- break ;
2109
-
2110
2097
case ConstraintKind::Defaultable:
2111
2098
case ConstraintKind::FallbackType: {
2112
2099
Defaults.erase (constraint);
@@ -2150,7 +2137,6 @@ void PotentialBindings::reset() {
2150
2137
if (CONDITIONAL_ASSERT_enabled ()) {
2151
2138
ASSERT (Constraints.empty ());
2152
2139
ASSERT (Bindings.empty ());
2153
- ASSERT (Literals.empty ());
2154
2140
ASSERT (Defaults.empty ());
2155
2141
ASSERT (DelayedBy.empty ());
2156
2142
ASSERT (AdjacentVars.empty ());
0 commit comments