mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Properly Compare True and False Order in Sourcekit
Comparing "false" > "true" will return 0, which when returned by compare indicates the two are equal which will result in a non deterministic ordering of "false" and "true". Using .compare returns a negative number as expected.
This commit is contained in:
@@ -817,7 +817,7 @@ static int compareLiterals(Item &a_, Item &b_) {
|
||||
|
||||
// Sort true before false instead of alphabetically.
|
||||
if (cast<Result>(a_).value->getLiteralKind() == CodeCompletionLiteralKind::BooleanLiteral)
|
||||
return a_.name > b_.name;
|
||||
return b_.name.compare(a_.name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user