@@ -152,7 +152,6 @@ bool ConstraintSystem::PotentialBindings::isPotentiallyIncomplete() const {
152
152
}
153
153
154
154
void ConstraintSystem::PotentialBindings::inferTransitiveProtocolRequirements (
155
- const ConstraintSystem &cs,
156
155
llvm::SmallDenseMap<TypeVariableType *, ConstraintSystem::PotentialBindings>
157
156
&inferredBindings) {
158
157
if (TransitiveProtocols)
@@ -283,7 +282,6 @@ void ConstraintSystem::PotentialBindings::inferTransitiveProtocolRequirements(
283
282
}
284
283
285
284
void ConstraintSystem::PotentialBindings::inferTransitiveBindings (
286
- ConstraintSystem &cs,
287
285
const llvm::SmallDenseMap<TypeVariableType *,
288
286
ConstraintSystem::PotentialBindings>
289
287
&inferredBindings) {
@@ -353,11 +351,10 @@ void ConstraintSystem::PotentialBindings::inferTransitiveBindings(
353
351
}
354
352
355
353
void ConstraintSystem::PotentialBindings::finalize (
356
- ConstraintSystem &cs,
357
354
llvm::SmallDenseMap<TypeVariableType *, ConstraintSystem::PotentialBindings>
358
355
&inferredBindings) {
359
- inferTransitiveProtocolRequirements (cs, inferredBindings);
360
- inferTransitiveBindings (cs, inferredBindings);
356
+ inferTransitiveProtocolRequirements (inferredBindings);
357
+ inferTransitiveBindings (inferredBindings);
361
358
}
362
359
363
360
Optional<ConstraintSystem::PotentialBindings>
@@ -411,7 +408,7 @@ ConstraintSystem::determineBestBindings() {
411
408
// produce a default type.
412
409
bool isViable = isViableForRanking (bindings);
413
410
414
- bindings.finalize (* this , cache);
411
+ bindings.finalize (cache);
415
412
416
413
if (!bindings || !isViable)
417
414
continue ;
@@ -775,7 +772,7 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar, bool finalize) {
775
772
typeVar, ConstraintGraph::GatheringKind::EquivalenceClass);
776
773
777
774
for (auto *constraint : constraints) {
778
- bool failed = bindings.infer (* this , constraint);
775
+ bool failed = bindings.infer (constraint);
779
776
780
777
// Upon inference failure let's produce an empty set of bindings.
781
778
if (failed)
@@ -786,7 +783,7 @@ ConstraintSystem::inferBindingsFor(TypeVariableType *typeVar, bool finalize) {
786
783
llvm::SmallDenseMap<TypeVariableType *, ConstraintSystem::PotentialBindings>
787
784
inferred;
788
785
789
- bindings.finalize (* this , inferred);
786
+ bindings.finalize (inferred);
790
787
}
791
788
792
789
return bindings;
@@ -995,8 +992,7 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
995
992
// / Retrieve the set of potential type bindings for the given
996
993
// / representative type variable, along with flags indicating whether
997
994
// / those types should be opened.
998
- bool ConstraintSystem::PotentialBindings::infer (ConstraintSystem &cs,
999
- Constraint *constraint) {
995
+ bool ConstraintSystem::PotentialBindings::infer (Constraint *constraint) {
1000
996
switch (constraint->getKind ()) {
1001
997
case ConstraintKind::Bind:
1002
998
case ConstraintKind::Equal:
@@ -1008,7 +1004,7 @@ bool ConstraintSystem::PotentialBindings::infer(ConstraintSystem &cs,
1008
1004
case ConstraintKind::OperatorArgumentConversion:
1009
1005
case ConstraintKind::OptionalObject: {
1010
1006
auto binding =
1011
- cs .getPotentialBindingForRelationalConstraint (*this , constraint);
1007
+ CS .getPotentialBindingForRelationalConstraint (*this , constraint);
1012
1008
if (!binding)
1013
1009
break ;
1014
1010
@@ -1036,7 +1032,7 @@ bool ConstraintSystem::PotentialBindings::infer(ConstraintSystem &cs,
1036
1032
// let's have it try `Void` as well because there is an
1037
1033
// implicit conversion `() -> T` to `() -> Void` and this
1038
1034
// helps to avoid creating a thunk to support it.
1039
- auto voidType = cs .getASTContext ().TheEmptyTupleType ;
1035
+ auto voidType = CS .getASTContext ().TheEmptyTupleType ;
1040
1036
if (locator->isLastElement <LocatorPathElt::ClosureResult>() &&
1041
1037
binding->Kind == AllowedBindingKind::Supertypes) {
1042
1038
(void )addPotentialBinding ({voidType, binding->Kind , constraint},
@@ -1053,7 +1049,7 @@ bool ConstraintSystem::PotentialBindings::infer(ConstraintSystem &cs,
1053
1049
// we try to bind the key path type first, which can allow us to discover
1054
1050
// additional bindings for the result type.
1055
1051
SmallPtrSet<TypeVariableType *, 4 > typeVars;
1056
- findInferableTypeVars (cs .simplifyType (constraint->getThirdType ()),
1052
+ findInferableTypeVars (CS .simplifyType (constraint->getThirdType ()),
1057
1053
typeVars);
1058
1054
if (typeVars.count (TypeVar)) {
1059
1055
DelayedBy.push_back (constraint);
@@ -1092,7 +1088,7 @@ bool ConstraintSystem::PotentialBindings::infer(ConstraintSystem &cs,
1092
1088
case ConstraintKind::Defaultable:
1093
1089
case ConstraintKind::DefaultClosureType:
1094
1090
// Do these in a separate pass.
1095
- if (cs .getFixedTypeRecursive (constraint->getFirstType (), true )
1091
+ if (CS .getFixedTypeRecursive (constraint->getFirstType (), true )
1096
1092
->getAs <TypeVariableType>() == TypeVar) {
1097
1093
addDefault (constraint);
1098
1094
}
@@ -1133,9 +1129,9 @@ bool ConstraintSystem::PotentialBindings::infer(ConstraintSystem &cs,
1133
1129
// and if so it would be beneficial to bind member to a hole
1134
1130
// early to propagate that information down to arguments,
1135
1131
// result type of a call that references such a member.
1136
- if (cs .shouldAttemptFixes () && TypeVar->getImpl ().canBindToHole ()) {
1132
+ if (CS .shouldAttemptFixes () && TypeVar->getImpl ().canBindToHole ()) {
1137
1133
if (ConstraintSystem::typeVarOccursInType (
1138
- TypeVar, cs .simplifyType (constraint->getSecondType ())))
1134
+ TypeVar, CS .simplifyType (constraint->getSecondType ())))
1139
1135
break ;
1140
1136
}
1141
1137
0 commit comments