Skip to content

Commit 1f61c43

Browse files
committed
AST: Remove no longer necessary checks of getSuperclassForDecl() result
1 parent d917fdb commit 1f61c43

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

lib/AST/ConformanceLookupTable.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,6 @@ DeclContext *ConformanceLookupTable::getConformingContext(
862862
Type classTy = nominal->getDeclaredInterfaceType();
863863
do {
864864
Type superclassTy = classTy->getSuperclassForDecl(superclassDecl);
865-
if (superclassTy->is<ErrorType>())
866-
return nullptr;
867865
auto inheritedConformance = swift::lookupConformance(
868866
superclassTy, protocol, /*allowMissing=*/false);
869867
if (inheritedConformance)
@@ -936,8 +934,6 @@ ConformanceLookupTable::getConformance(NominalTypeDecl *nominal,
936934
// declared.
937935
auto *conformingClass = cast<ClassDecl>(conformingNominal);
938936
Type superclassTy = type->getSuperclassForDecl(conformingClass);
939-
if (superclassTy->is<ErrorType>())
940-
return nullptr;
941937

942938
// Look up the inherited conformance.
943939
auto inheritedConformance = swift::lookupConformance(

lib/Sema/TypeCheckStorage.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,12 +1146,7 @@ static Expr *buildStorageReference(AccessorDecl *accessor,
11461146
auto *baseClass = override->getDeclContext()->getSelfClassDecl();
11471147
selfTypeForAccess = selfTypeForAccess->getSuperclassForDecl(baseClass);
11481148

1149-
// Error recovery path. We get an ErrorType here if getSuperclassForDecl()
1150-
// fails (because, for instance, a generic parameter of a generic nominal
1151-
// type cannot be resolved).
1152-
if (!selfTypeForAccess->is<ErrorType>()) {
1153-
subs = selfTypeForAccess->getContextSubstitutionMap(baseClass);
1154-
}
1149+
subs = selfTypeForAccess->getContextSubstitutionMap(baseClass);
11551150

11561151
storage = override;
11571152

0 commit comments

Comments
 (0)