Skip to content

Commit c70dce0

Browse files
authored
Merge pull request swiftlang#31515 from AnthonyLatsis/assert-type-param-requires-class
AST: Assert we were given a type parameter in GenericSignatureImpl::requiresClass
2 parents fa4800b + ab1ca1d commit c70dce0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ GenericSignatureImpl::lookupConformance(CanType type,
379379
}
380380

381381
bool GenericSignatureImpl::requiresClass(Type type) {
382-
if (!type->isTypeParameter()) return false;
382+
assert(type->isTypeParameter() &&
383+
"Only type parameters can have superclass requirements");
383384

384385
auto &builder = *getGenericSignatureBuilder();
385386
auto equivClass =

lib/SIL/IR/AbstractionPattern.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ bool AbstractionPattern::requiresClass() const {
222222
auto type = getType();
223223
if (auto archetype = dyn_cast<ArchetypeType>(type))
224224
return archetype->requiresClass();
225-
if (isa<DependentMemberType>(type) ||
226-
isa<GenericTypeParamType>(type)) {
225+
if (type->isTypeParameter()) {
227226
if (getKind() == Kind::ClangType) {
228227
// ObjC generics are always class constrained.
229228
return true;

0 commit comments

Comments
 (0)