Skip to content

Commit 3b73065

Browse files
Merge pull request #31712 from AnthonyLatsis/assert-type-param-2
GenericSignatureImpl: Assert we were given type parameters in getSuperclassBound & conformsToProtocol
2 parents 6c646ec + 5343438 commit 3b73065

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ bool GenericSignatureImpl::requiresClass(Type type) {
411411

412412
/// Determine the superclass bound on the given dependent type.
413413
Type GenericSignatureImpl::getSuperclassBound(Type type) {
414-
if (!type->isTypeParameter()) return nullptr;
414+
assert(type->isTypeParameter() &&
415+
"Only type parameters can have superclass requirements");
415416

416417
auto &builder = *getGenericSignatureBuilder();
417418
auto equivClass =
@@ -457,8 +458,7 @@ GenericSignatureImpl::getConformsTo(Type type) {
457458
}
458459

459460
bool GenericSignatureImpl::conformsToProtocol(Type type, ProtocolDecl *proto) {
460-
// FIXME: Deal with concrete conformances here?
461-
if (!type->isTypeParameter()) return false;
461+
assert(type->isTypeParameter() && "Expected a type parameter");
462462

463463
auto &builder = *getGenericSignatureBuilder();
464464
auto equivClass =
@@ -562,7 +562,7 @@ bool GenericSignatureImpl::isRequirementSatisfied(Requirement requirement) {
562562
// requirement, but it could also be in terms of concrete types if it has
563563
// been substituted/otherwise 'resolved', so we need to handle both.
564564
auto baseType = canFirstType;
565-
if (canFirstType->isTypeParameter()) {
565+
if (baseType->isTypeParameter()) {
566566
auto directSuperclass = getSuperclassBound(baseType);
567567
if (!directSuperclass)
568568
return false;

0 commit comments

Comments
 (0)