From ab1ca1d6f79597dc0cd87054f5be9f1481a1e431 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Sun, 3 May 2020 16:46:52 +0300 Subject: [PATCH] AST: Assert we were given a type parameter in GenericSignatureImpl::requiresClass --- lib/AST/GenericSignature.cpp | 3 ++- lib/SIL/IR/AbstractionPattern.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/AST/GenericSignature.cpp b/lib/AST/GenericSignature.cpp index 46b8dcac3fd02..a0e55c335a459 100644 --- a/lib/AST/GenericSignature.cpp +++ b/lib/AST/GenericSignature.cpp @@ -379,7 +379,8 @@ GenericSignatureImpl::lookupConformance(CanType type, } bool GenericSignatureImpl::requiresClass(Type type) { - if (!type->isTypeParameter()) return false; + assert(type->isTypeParameter() && + "Only type parameters can have superclass requirements"); auto &builder = *getGenericSignatureBuilder(); auto equivClass = diff --git a/lib/SIL/IR/AbstractionPattern.cpp b/lib/SIL/IR/AbstractionPattern.cpp index 1b4738e4a4648..9f8592da05d99 100644 --- a/lib/SIL/IR/AbstractionPattern.cpp +++ b/lib/SIL/IR/AbstractionPattern.cpp @@ -222,8 +222,7 @@ bool AbstractionPattern::requiresClass() const { auto type = getType(); if (auto archetype = dyn_cast(type)) return archetype->requiresClass(); - if (isa(type) || - isa(type)) { + if (type->isTypeParameter()) { if (getKind() == Kind::ClangType) { // ObjC generics are always class constrained. return true;