Skip to content

Commit ec8afd5

Browse files
committed
[CS] NFC: Remove SolutionApplicationToFunctionResult
This is now no longer needed.
1 parent 0025e8f commit ec8afd5

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,15 +2080,6 @@ enum class ConstraintSystemPhase {
20802080
Finalization
20812081
};
20822082

2083-
/// Describes the result of applying a solution to a given function.
2084-
enum class SolutionApplicationToFunctionResult {
2085-
/// Application of the solution succeeded.
2086-
Success,
2087-
/// Application of the solution failed.
2088-
/// TODO: This should probably go away entirely.
2089-
Failure,
2090-
};
2091-
20922083
/// Retrieve the closure type from the constraint system.
20932084
struct GetClosureType {
20942085
ConstraintSystem &cs;
@@ -5543,8 +5534,8 @@ class ConstraintSystem {
55435534
/// \param fn The function to which the solution is being applied.
55445535
/// \param rewriter The rewriter to apply the solution with.
55455536
///
5546-
SolutionApplicationToFunctionResult
5547-
applySolution(AnyFunctionRef fn, SyntacticElementTargetRewriter &rewriter);
5537+
bool applySolution(AnyFunctionRef fn,
5538+
SyntacticElementTargetRewriter &rewriter);
55485539

55495540
/// Apply the given solution to the given closure body.
55505541
///

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8907,13 +8907,7 @@ namespace {
89078907
///
89088908
/// \returns true if an error occurred.
89098909
bool rewriteFunction(AnyFunctionRef fn) {
8910-
switch (Rewriter.cs.applySolution(fn, *this)) {
8911-
case SolutionApplicationToFunctionResult::Success:
8912-
return false;
8913-
8914-
case SolutionApplicationToFunctionResult::Failure:
8915-
return true;
8916-
}
8910+
return Rewriter.cs.applySolution(fn, *this);
89178911
}
89188912

89198913
bool rewriteSingleValueStmtExpr(SingleValueStmtExpr *SVE) {

lib/Sema/CSSyntacticElement.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,9 +2541,8 @@ static void applySolutionToClosurePropertyWrappers(ClosureExpr *closure,
25412541
}
25422542
}
25432543

2544-
SolutionApplicationToFunctionResult
2545-
ConstraintSystem::applySolution(AnyFunctionRef fn,
2546-
SyntacticElementTargetRewriter &rewriter) {
2544+
bool ConstraintSystem::applySolution(AnyFunctionRef fn,
2545+
SyntacticElementTargetRewriter &rewriter) {
25472546
auto &solution = rewriter.getSolution();
25482547
auto &cs = solution.getConstraintSystem();
25492548
auto *closure = getAsExpr<ClosureExpr>(fn.getAbstractClosureExpr());
@@ -2590,14 +2589,10 @@ ConstraintSystem::applySolution(AnyFunctionRef fn,
25902589
fn.setParsedBody(transform->transformedBody);
25912590

25922591
ResultBuilderRewriter builderRewriter(fn, *transform, rewriter);
2593-
return builderRewriter.apply() ? SolutionApplicationToFunctionResult::Failure
2594-
: SolutionApplicationToFunctionResult::Success;
2592+
return builderRewriter.apply();
25952593
}
25962594
assert(closure && "Can only get here with a closure at the moment");
2597-
2598-
bool hadError = applySolutionToBody(closure, rewriter);
2599-
return hadError ? SolutionApplicationToFunctionResult::Failure
2600-
: SolutionApplicationToFunctionResult::Success;
2595+
return applySolutionToBody(closure, rewriter);
26012596
}
26022597

26032598
bool ConstraintSystem::applySolutionToBody(

0 commit comments

Comments
 (0)