Skip to content

Commit f9ed50e

Browse files
committed
AST: More detailed error message from GenericSignature::verify()
1 parent 512a159 commit f9ed50e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,11 @@ void GenericSignature::verify() const {
882882

883883
void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
884884
auto dumpAndAbort = [&]() {
885+
llvm::errs() << "All requirements:\n";
886+
for (auto reqt : reqts) {
887+
reqt.dump(llvm::errs());
888+
llvm::errs() << "\n";
889+
}
885890
getPointer()->getRequirementMachine()->dump(llvm::errs());
886891
abort();
887892
};
@@ -1081,7 +1086,14 @@ void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
10811086
ProtocolType::canonicalizeProtocols(canonicalProtos);
10821087

10831088
if (protos.size() != canonicalProtos.size()) {
1084-
llvm::errs() << "Redundant conformance requirements in signature\n";
1089+
llvm::errs() << "Redundant conformance requirements in signature "
1090+
<< *this << ":\n";
1091+
llvm::errs() << "Ours:\n";
1092+
for (auto *proto : protos)
1093+
llvm::errs() << "- " << proto->getName() << "\n";
1094+
llvm::errs() << "Theirs:\n";
1095+
for (auto *proto : canonicalProtos)
1096+
llvm::errs() << "- " << proto->getName() << "\n";
10851097
dumpAndAbort();
10861098
}
10871099
if (!std::equal(protos.begin(), protos.end(), canonicalProtos.begin())) {

0 commit comments

Comments
 (0)