@@ -65,14 +65,20 @@ BindingSet::BindingSet(ConstraintSystem &CS, TypeVariableType *TypeVar,
65
65
addLiteralRequirement (constraint);
66
66
break ;
67
67
68
+ case ConstraintKind::Defaultable:
69
+ case ConstraintKind::FallbackType:
70
+ // Do these in a separate pass.
71
+ if (CS.getFixedTypeRecursive (constraint->getFirstType (), true )
72
+ ->getAs <TypeVariableType>() == TypeVar) {
73
+ addDefault (constraint);
74
+ }
75
+ break ;
76
+
68
77
default :
69
78
break ;
70
79
}
71
80
}
72
81
73
- for (auto *constraint : info.Defaults )
74
- addDefault (constraint);
75
-
76
82
for (auto &entry : info.AdjacentVars )
77
83
AdjacentVars.insert (entry.first );
78
84
}
@@ -1215,10 +1221,6 @@ findInferableTypeVars(Type type,
1215
1221
type.walk (Walker (typeVars));
1216
1222
}
1217
1223
1218
- void PotentialBindings::addDefault (Constraint *constraint) {
1219
- Defaults.insert (constraint);
1220
- }
1221
-
1222
1224
void BindingSet::addDefault (Constraint *constraint) {
1223
1225
auto defaultTy = constraint->getSecondType ();
1224
1226
Defaults.insert ({defaultTy->getCanonicalType (), constraint});
@@ -1968,6 +1970,8 @@ void PotentialBindings::infer(ConstraintSystem &CS,
1968
1970
case ConstraintKind::MaterializePackExpansion:
1969
1971
case ConstraintKind::ConformsTo:
1970
1972
case ConstraintKind::LiteralConformsTo:
1973
+ case ConstraintKind::Defaultable:
1974
+ case ConstraintKind::FallbackType:
1971
1975
// Constraints from which we can't do anything.
1972
1976
break ;
1973
1977
@@ -1995,15 +1999,6 @@ void PotentialBindings::infer(ConstraintSystem &CS,
1995
1999
break ;
1996
2000
}
1997
2001
1998
- case ConstraintKind::Defaultable:
1999
- case ConstraintKind::FallbackType:
2000
- // Do these in a separate pass.
2001
- if (CS.getFixedTypeRecursive (constraint->getFirstType (), true )
2002
- ->getAs <TypeVariableType>() == TypeVar) {
2003
- addDefault (constraint);
2004
- }
2005
- break ;
2006
-
2007
2002
case ConstraintKind::Disjunction:
2008
2003
DelayedBy.push_back (constraint);
2009
2004
break ;
@@ -2093,17 +2088,6 @@ void PotentialBindings::retract(ConstraintSystem &CS,
2093
2088
}),
2094
2089
Bindings.end ());
2095
2090
2096
- switch (constraint->getKind ()) {
2097
- case ConstraintKind::Defaultable:
2098
- case ConstraintKind::FallbackType: {
2099
- Defaults.erase (constraint);
2100
- break ;
2101
- }
2102
-
2103
- default :
2104
- break ;
2105
- }
2106
-
2107
2091
{
2108
2092
llvm::SmallPtrSet<TypeVariableType *, 2 > unviable;
2109
2093
for (const auto &adjacent : AdjacentVars) {
@@ -2137,7 +2121,6 @@ void PotentialBindings::reset() {
2137
2121
if (CONDITIONAL_ASSERT_enabled ()) {
2138
2122
ASSERT (Constraints.empty ());
2139
2123
ASSERT (Bindings.empty ());
2140
- ASSERT (Defaults.empty ());
2141
2124
ASSERT (DelayedBy.empty ());
2142
2125
ASSERT (AdjacentVars.empty ());
2143
2126
ASSERT (SubtypeOf.empty ());
0 commit comments