Skip to content

Commit 3dd54c2

Browse files
committed
Remove explicit calls to computeRequirementSignature
We can rely on lazy calls to getRequirementSignature instead.
1 parent 6c92927 commit 3dd54c2

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,6 @@ static bool hasNonCanonicalSelfProtocolRequirement(
771771
// If we don't already have a requirement signature for this protocol,
772772
// build one now.
773773
auto inProto = source->getProtocolDecl();
774-
if (!inProto->isRequirementSignatureComputed()) {
775-
inProto->computeRequirementSignature();
776-
assert(inProto->isRequirementSignatureComputed() &&
777-
"couldn't compute requirement signature?");
778-
}
779774

780775
// Check whether the given requirement is in the requirement signature.
781776
if (!source->usesRequirementSignature &&
@@ -856,13 +851,9 @@ void GenericSignature::buildConformanceAccessPath(
856851

857852
// The generic signature builder we're using for this protocol
858853
// wasn't built from its own requirement signature, so we can't
859-
// trust it. Make sure we have a requirement signature, then build
860-
// a new generic signature builder.
854+
// trust it, build a new generic signature builder.
861855
// FIXME: It would be better if we could replace the canonical generic
862856
// signature builder with the rebuilt one.
863-
if (!requirementSignatureProto->isRequirementSignatureComputed())
864-
requirementSignatureProto->computeRequirementSignature();
865-
assert(requirementSignatureProto->isRequirementSignatureComputed());
866857

867858
replacementBuilder.emplace(getASTContext());
868859
replacementBuilder->addGenericSignature(

lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4521,10 +4521,6 @@ namespace {
45214521
inheritedTypes);
45224522
result->setInherited(Impl.SwiftContext.AllocateCopy(inheritedTypes));
45234523

4524-
// Compute the requirement signature.
4525-
if (!result->isRequirementSignatureComputed())
4526-
result->computeRequirementSignature();
4527-
45284524
result->setMemberLoader(&Impl, 0);
45294525

45304526
// Add the protocol decl to ExternalDefinitions so that IRGen can emit
@@ -7878,9 +7874,6 @@ void ClangImporter::Implementation::finishNormalConformance(
78787874
PrettyStackTraceConformance trace(SwiftContext, "completing import of",
78797875
conformance);
78807876

7881-
if (!proto->isRequirementSignatureComputed())
7882-
proto->computeRequirementSignature();
7883-
78847877
finishTypeWitnesses(conformance);
78857878
finishInheritedConformances(conformance);
78867879
finishSignatureConformances(conformance);

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,8 @@ GenericEnvironment *TypeChecker::checkGenericEnvironment(
729729

730730
void TypeChecker::validateGenericTypeSignature(GenericTypeDecl *typeDecl) {
731731
if (auto *proto = dyn_cast<ProtocolDecl>(typeDecl)) {
732-
// Compute the requirement signature first.
733-
if (!proto->isRequirementSignatureComputed())
734-
proto->computeRequirementSignature();
735-
732+
// The requirement signature is created lazily by
733+
// ProtocolDecl::getRequirementSignature().
736734
// The generic signature and environment is created lazily by
737735
// GenericContext::getGenericSignature(), so there is nothing we
738736
// need to do.

0 commit comments

Comments
 (0)