Skip to content

Commit ba174ae

Browse files
committed
Sema: More debugging messages in associated type inference
1 parent c5c6e00 commit ba174ae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/Sema/AssociatedTypeInference.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,9 @@ AssociatedTypeInference::inferTypeWitnessesViaValueWitnesses(
13391339

13401340
InferredAssociatedTypesByWitnesses result;
13411341

1342+
LLVM_DEBUG(llvm::dbgs() << "Considering requirement:\n";
1343+
req->dump(llvm::dbgs()));
1344+
13421345
for (auto witness :
13431346
lookupValueWitnesses(dc, req, /*ignoringNames=*/nullptr)) {
13441347
LLVM_DEBUG(llvm::dbgs() << "Inferring associated types from decl:\n";
@@ -1620,6 +1623,7 @@ static Type getWitnessTypeForMatching(NormalProtocolConformance *conformance,
16201623
conformance->getDeclContext()->mapTypeIntoContext(conformance->getType());
16211624
TypeSubstitutionMap substitutions = model->getMemberSubstitutions(witness);
16221625
Type type = witness->getInterfaceType()->getReferenceStorageReferent();
1626+
LLVM_DEBUG(llvm::dbgs() << "Witness interface type is " << type << "\n";);
16231627

16241628
if (substitutions.empty())
16251629
return type;
@@ -2139,9 +2143,14 @@ void AssociatedTypeInference::collectAbstractTypeWitnesses(
21392143
if (ctx.isRecursivelyConstructingRequirementMachine(
21402144
conformedProto->getGenericSignature().getCanonicalSignature()) ||
21412145
ctx.isRecursivelyConstructingRequirementMachine(conformedProto) ||
2142-
conformedProto->isComputingRequirementSignature())
2146+
conformedProto->isComputingRequirementSignature()) {
2147+
LLVM_DEBUG(llvm::dbgs() << "Skipping circular protocol "
2148+
<< conformedProto->getName() << "\n");
21432149
return;
2150+
}
21442151

2152+
LLVM_DEBUG(llvm::dbgs() << "Collecting same-type requirements from "
2153+
<< conformedProto->getName() << "\n");
21452154
for (const auto &req :
21462155
conformedProto->getRequirementSignature().getRequirements()) {
21472156
if (req.getKind() == RequirementKind::SameType)

0 commit comments

Comments
 (0)