diff --git a/include/swift/Sema/ConstraintSystem.h b/include/swift/Sema/ConstraintSystem.h index 3f59f2561b1..a6ad713ff2f 100644 --- a/include/swift/Sema/ConstraintSystem.h +++ b/include/swift/Sema/ConstraintSystem.h @@ -2080,15 +2080,6 @@ enum class ConstraintSystemPhase { Finalization }; -/// Describes the result of applying a solution to a given function. -enum class SolutionApplicationToFunctionResult { - /// Application of the solution succeeded. - Success, - /// Application of the solution failed. - /// TODO: This should probably go away entirely. - Failure, -}; - /// Retrieve the closure type from the constraint system. struct GetClosureType { ConstraintSystem &cs; @@ -5543,8 +5534,8 @@ public: /// \param fn The function to which the solution is being applied. /// \param rewriter The rewriter to apply the solution with. /// - SolutionApplicationToFunctionResult - applySolution(AnyFunctionRef fn, SyntacticElementTargetRewriter &rewriter); + bool applySolution(AnyFunctionRef fn, + SyntacticElementTargetRewriter &rewriter); /// Apply the given solution to the given closure body. /// diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 1dcb8eafb50..d7a999d1fe4 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -8907,13 +8907,7 @@ namespace { /// /// \returns true if an error occurred. bool rewriteFunction(AnyFunctionRef fn) { - switch (Rewriter.cs.applySolution(fn, *this)) { - case SolutionApplicationToFunctionResult::Success: - return false; - - case SolutionApplicationToFunctionResult::Failure: - return true; - } + return Rewriter.cs.applySolution(fn, *this); } bool rewriteSingleValueStmtExpr(SingleValueStmtExpr *SVE) { diff --git a/lib/Sema/CSSyntacticElement.cpp b/lib/Sema/CSSyntacticElement.cpp index 44ce08331f8..0d9b1b1d92b 100644 --- a/lib/Sema/CSSyntacticElement.cpp +++ b/lib/Sema/CSSyntacticElement.cpp @@ -2541,9 +2541,8 @@ static void applySolutionToClosurePropertyWrappers(ClosureExpr *closure, } } -SolutionApplicationToFunctionResult -ConstraintSystem::applySolution(AnyFunctionRef fn, - SyntacticElementTargetRewriter &rewriter) { +bool ConstraintSystem::applySolution(AnyFunctionRef fn, + SyntacticElementTargetRewriter &rewriter) { auto &solution = rewriter.getSolution(); auto &cs = solution.getConstraintSystem(); auto *closure = getAsExpr(fn.getAbstractClosureExpr()); @@ -2590,14 +2589,10 @@ ConstraintSystem::applySolution(AnyFunctionRef fn, fn.setParsedBody(transform->transformedBody); ResultBuilderRewriter builderRewriter(fn, *transform, rewriter); - return builderRewriter.apply() ? SolutionApplicationToFunctionResult::Failure - : SolutionApplicationToFunctionResult::Success; + return builderRewriter.apply(); } assert(closure && "Can only get here with a closure at the moment"); - - bool hadError = applySolutionToBody(closure, rewriter); - return hadError ? SolutionApplicationToFunctionResult::Failure - : SolutionApplicationToFunctionResult::Success; + return applySolutionToBody(closure, rewriter); } bool ConstraintSystem::applySolutionToBody(