Skip to content

Commit f1a53c3

Browse files
committed
[ConstraintSystem] Remove unnecessary forward declarations of the steps
Also move `DisjunctionStep` from being a friend of `ConstraintSystem` because it's not strictly necessary.
1 parent 6cf11b3 commit f1a53c3

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

lib/Sema/CSStep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ bool DisjunctionStep::attemptChoice(const DisjunctionChoice &choice) {
612612
// took for it.
613613
if (auto *disjunctionLocator = Producer.getLocator()) {
614614
auto index = choice.getIndex();
615-
CS.DisjunctionChoices.push_back({disjunctionLocator, index});
615+
recordDisjunctionChoice(disjunctionLocator, index);
616616

617617
// Implicit unwraps of optionals are worse solutions than those
618618
// not involving implicit unwraps.

lib/Sema/CSStep.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace swift {
3232
namespace constraints {
3333

3434
class SolverStep;
35+
class ComponentStep;
3536

3637
/// Represents available states which every
3738
/// given step could be in during it's lifetime.
@@ -200,6 +201,11 @@ class SolverStep {
200201
return CS.resolvedOverloadSets;
201202
}
202203

204+
void recordDisjunctionChoice(ConstraintLocator *disjunctionLocator,
205+
unsigned index) const {
206+
CS.DisjunctionChoices.push_back({disjunctionLocator, index});
207+
}
208+
203209
Score getCurrentScore() const { return CS.CurrentScore; }
204210

205211
Optional<Score> getBestScore() const { return CS.solverState->BestScore; }

lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@ namespace constraints {
5353
class ConstraintGraph;
5454
class ConstraintGraphNode;
5555
class ConstraintSystem;
56-
class DisjunctionChoiceProducer;
57-
class TypeBinding;
58-
class TypeVariableBinding;
59-
class TypeVarBindingProducer;
60-
class StepScope;
61-
class SolverStep;
62-
class SplitterStep;
63-
class ComponentStep;
64-
class TypeVariableStep;
65-
class DisjunctionStep;
6656

6757
} // end namespace constraints
6858

@@ -941,7 +931,6 @@ class ConstraintSystem {
941931
friend class SplitterStep;
942932
friend class ComponentStep;
943933
friend class TypeVariableStep;
944-
friend class DisjunctionStep;
945934

946935
class SolverScope;
947936

0 commit comments

Comments
 (0)