Skip to content

Commit 47ad3c9

Browse files
committed
GSB: Don't accidentally create a GSB from a requirement signature in an assert
When a protocol's requirement signature is being computed by GenericSignatureBuilder::computeGenericSignature(), we call checkGenericSignature(), which contains various assertions that call GenericSignature::isCanonicalTypeInContext(). One of these assertions forgot to pass the GSB instance down as the 'builder' parameter. The end result is that we would create a new GSB from the protocol's requirement signature, which is generally not well-formed since it does not have a conformance requirement on 'Self'. It seems this was harmless, other than the wasted CPU cycles, but it was caught by some RequirementMachine assertions.
1 parent bffba72 commit 47ad3c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8308,7 +8308,7 @@ static void checkGenericSignature(CanGenericSignature canSig,
83088308
assert(compareDependentTypes(firstType, secondType) < 0 &&
83098309
"Out-of-order type parameters in same-type constraint");
83108310
} else {
8311-
assert(canSig->isCanonicalTypeInContext(secondType) &&
8311+
assert(canSig->isCanonicalTypeInContext(secondType, builder) &&
83128312
"Concrete same-type isn't canonical in its own context");
83138313
}
83148314
break;

0 commit comments

Comments
 (0)