Skip to content

Commit 7f65620

Browse files
committed
[CSBindings] Fix std::rotate to move only Any
It used to move everything up to `Any`, now it's going to move only `Any` itself to the end of the list.
1 parent d726c90 commit 7f65620

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,14 @@ void ConstraintSystem::PotentialBindings::finalize(
342342
// it's always better to infer concrete type and erase it if required
343343
// by the context.
344344
if (Bindings.size() > 1) {
345-
auto anyType = llvm::find_if(Bindings, [](const PotentialBinding &binding) {
346-
return binding.BindingType->isAny() && !binding.isDefaultableBinding();
347-
});
345+
auto AnyTypePos =
346+
llvm::find_if(Bindings, [](const PotentialBinding &binding) {
347+
return binding.BindingType->isAny() &&
348+
!binding.isDefaultableBinding();
349+
});
348350

349-
if (anyType != Bindings.end()) {
350-
std::rotate(Bindings.begin(), anyType + 1, Bindings.end());
351+
if (AnyTypePos != Bindings.end()) {
352+
std::rotate(AnyTypePos, AnyTypePos + 1, Bindings.end());
351353
}
352354
}
353355

0 commit comments

Comments
 (0)