Skip to content

Commit e400a96

Browse files
committed
GSB: Loosen up verifyGenericSignature()
We used to assert if a generic requirement of a signature could be proved from the signature with the requirement removed. However, in some rare cases minimization can *add* new requirements as well as remove them. This is going to come up even more with the RequirementMachine, where for example the following signature is accepted: protocol Q { associatedtype A : P } protocol P { associatedtype B } <T where T.A : Q, T.A.B == T> and minimized as follows: <T where T : P, T.A : Q, T.A.B == T>
1 parent dd88e0d commit e400a96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8513,6 +8513,11 @@ void GenericSignatureBuilder::verifyGenericSignature(ASTContext &context,
85138513
std::move(builder).computeGenericSignature(
85148514
/*allowConcreteGenericParams=*/true);
85158515

8516+
// If the new signature once again contains the removed requirement, it's
8517+
// not redundant.
8518+
if (newSig->isEqual(sig))
8519+
continue;
8520+
85168521
// If the removed requirement is satisfied by the new generic signature,
85178522
// it is redundant. Complain.
85188523
if (newSig->isRequirementSatisfied(requirements[victimIndex])) {

0 commit comments

Comments
 (0)