mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Constraint] Sort constraint printing by favored, unmarked, and disabled in that order for printing only.
This commit is contained in:
@@ -343,8 +343,21 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm, bool skipLocat
|
||||
Out << "]]";
|
||||
}
|
||||
Out << ":\n";
|
||||
|
||||
// Sort constraints by favored, unmarked, disabled
|
||||
// for printing only.
|
||||
std::vector<Constraint *> sortedConstraints(getNestedConstraints().begin(),
|
||||
getNestedConstraints().end());
|
||||
llvm::sort(sortedConstraints,
|
||||
[](const Constraint *lhs, const Constraint *rhs) {
|
||||
if (lhs->isFavored() != rhs->isFavored())
|
||||
return lhs->isFavored();
|
||||
if (lhs->isDisabled() != rhs->isDisabled())
|
||||
return rhs->isDisabled();
|
||||
return false;
|
||||
});
|
||||
|
||||
interleave(getNestedConstraints(),
|
||||
interleave(sortedConstraints,
|
||||
[&](Constraint *constraint) {
|
||||
if (constraint->isDisabled())
|
||||
Out << "> [disabled] ";
|
||||
|
||||
Reference in New Issue
Block a user