Skip to content

Commit e10ecbd

Browse files
committed
[GSB] Only check protocol requirements not generated from the signature.
If we used the requirement signature to create a protocol requirement element in a requirement source, there's no need to verify that it's from the requirement signature (duh).
1 parent a77dec1 commit e10ecbd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,11 @@ class GenericSignatureBuilder::RequirementSource final
936936
/// Whether there is a trailing written requirement location.
937937
const bool hasTrailingWrittenRequirementLoc;
938938

939+
public:
939940
/// Whether a protocol requirement came from the requirement signature.
940941
const bool usesRequirementSignature;
941942

943+
private:
942944
/// The actual storage, described by \c storageKind.
943945
union {
944946
/// The type to which a requirement applies.

lib/AST/GenericSignature.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,8 @@ static bool hasNonCanonicalSelfProtocolRequirement(
939939
}
940940

941941
// Check whether the given requirement is in the requirement signature.
942-
if (!hasConformanceInSignature(inProto->getRequirementSignature(),
942+
if (!source->usesRequirementSignature &&
943+
!hasConformanceInSignature(inProto->getRequirementSignature(),
943944
source->getStoredType(), conformingProto))
944945
return true;
945946

0 commit comments

Comments
 (0)