Skip to content

Commit f53c6a4

Browse files
[AST] Fix DeclBaseName::compare()
Fix `DeclBaseName::compare()` to not return equal on two base names of different kinds but have the same user facing names.
1 parent a5a84f1 commit f53c6a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/swift/AST/Identifier.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,11 @@ class DeclBaseName {
385385
}
386386

387387
int compare(DeclBaseName other) const {
388-
return userFacingName().compare(other.userFacingName());
388+
if (int result = userFacingName().compare(other.userFacingName()))
389+
return result;
390+
if (getKind() == other.getKind())
391+
return 0;
392+
return getKind() < other.getKind() ? -1 : 1;
389393
}
390394

391395
bool operator==(StringRef Str) const {

0 commit comments

Comments
 (0)