getInterfaceType() always returns a type (#28210)

getInterfaceType() always returns a type
This commit is contained in:
Hamish Knight
2019-11-12 13:24:05 -08:00
committed by GitHub
15 changed files with 52 additions and 97 deletions

View File

@@ -3431,11 +3431,7 @@ Type TypeDecl::getDeclaredInterfaceType() const {
selfTy, const_cast<AssociatedTypeDecl *>(ATD));
}
Type interfaceType = getInterfaceType();
if (!interfaceType)
return ErrorType::get(getASTContext());
return interfaceType->getMetatypeInstanceType();
return getInterfaceType()->getMetatypeInstanceType();
}
int TypeDecl::compare(const TypeDecl *type1, const TypeDecl *type2) {
@@ -4776,10 +4772,6 @@ ProtocolDecl::findProtocolSelfReferences(const ValueDecl *value,
auto type = value->getInterfaceType();
// FIXME: Deal with broken recursion.
if (!type)
return SelfReferenceKind::None();
// Skip invalid declarations.
if (type->hasError())
return SelfReferenceKind::None();