Skip to content

Commit f81e4c9

Browse files
committed
AST: Fix Requirement::compare() for self-comparison
std::sort() will sometimes compare an element with itself (?) so remove the assert here. Duplicate conformance requirements should be already caught by checkGenericSignature() anyway.
1 parent 399e90e commit f81e4c9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,11 +1483,7 @@ int Requirement::compare(const Requirement &other) const {
14831483
// We should only have multiple conformance requirements.
14841484
assert(getKind() == RequirementKind::Conformance);
14851485

1486-
int compareProtos =
1487-
TypeDecl::compare(getProtocolDecl(), other.getProtocolDecl());
1488-
1489-
assert(compareProtos != 0 && "Duplicate conformance requirement");
1490-
return compareProtos;
1486+
return TypeDecl::compare(getProtocolDecl(), other.getProtocolDecl());
14911487
}
14921488

14931489
/// Compare two associated types.

0 commit comments

Comments
 (0)