Skip to content

Commit 1e6f813

Browse files
committed
When popping something off the end of a top-N collection, if that thing
was accepted, we need to adjust EndOfAccepted.
1 parent f3500e4 commit 1e6f813

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/swift/Basic/TopCollection.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ class TopCollection {
158158
Data[i].Score = score;
159159
Data[i].Value = std::move(value);
160160
} else {
161-
if (Data.size() == MaxSize)
161+
if (Data.size() == MaxSize) {
162162
Data.pop_back();
163+
if (EndOfAccepted == MaxSize)
164+
EndOfAccepted--;
165+
}
163166
Data.insert(Data.begin() + i, { score, std::move(value) });
164167
}
165168

0 commit comments

Comments
 (0)