Skip to content

Commit 6c2e4ec

Browse files
committed
Sema: Rename restoreCurrentScore() to updateScoreAfterConjunction()
1 parent 38fe069 commit 6c2e4ec

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/Sema/CSStep.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ StepResult ConjunctionStep::resume(bool prevFailed) {
10331033
// restored right afterwards because score of the
10341034
// element does contribute to the overall score.
10351035
restoreBestScore();
1036-
restoreCurrentScore(solution.getFixedScore());
1036+
updateScoreAfterConjunction(solution.getFixedScore());
10371037

10381038
// Transform all of the unbound outer variables into
10391039
// placeholders since we are not going to solve for
@@ -1085,10 +1085,10 @@ StepResult ConjunctionStep::resume(bool prevFailed) {
10851085
}
10861086

10871087
void ConjunctionStep::restoreOuterState(const Score &solutionScore) const {
1088-
// Restore best/current score, since upcoming step is going to
1089-
// work with outer scope in relation to the conjunction.
1088+
// Restore best score and update current score, since upcoming step
1089+
// is going to work with outer scope in relation to the conjunction.
10901090
restoreBestScore();
1091-
restoreCurrentScore(solutionScore);
1091+
updateScoreAfterConjunction(solutionScore);
10921092

10931093
// Active all of the previously out-of-scope constraints
10941094
// because conjunction can propagate type information up

lib/Sema/CSStep.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,10 @@ class ConjunctionStep : public BindingStep<ConjunctionElementProducer> {
10271027
}
10281028

10291029
private:
1030-
/// Restore best and current scores as they were before conjunction.
1031-
void restoreCurrentScore(const Score &solutionScore) const {
1030+
/// We need to do this to make sure that we rank solutions with
1031+
/// invalid closures appropriately and don’t produce a valid
1032+
/// solution if a multi-statement closure failed.
1033+
void updateScoreAfterConjunction(const Score &solutionScore) const {
10321034
CS.increaseScore(SK_Fix, Conjunction->getLocator(),
10331035
solutionScore.Data[SK_Fix]);
10341036
CS.increaseScore(SK_Hole, Conjunction->getLocator(),

0 commit comments

Comments
 (0)