Skip to content

Commit 5343438

Browse files
committed
GenericSignatureImpl: Assert we were given type parameters in getSuperclassBound & conformsToProtocol
1 parent 7b787a6 commit 5343438

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
@@ -410,7 +410,8 @@ bool GenericSignatureImpl::requiresClass(Type type) {
410410

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

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

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

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

0 commit comments

Comments
 (0)