Skip to content

Commit 9e2ebd0

Browse files
authored
Merge pull request #19021 from DougGregor/sr-8642
[Conformance lookup] Don’t form an inherited conformance to an error type.
2 parents f3fc294 + a4d464f commit 9e2ebd0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/AST/ConformanceLookupTable.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ ConformanceLookupTable::getConformance(NominalTypeDecl *nominal,
818818
// declared.
819819
auto *conformingClass = cast<ClassDecl>(conformingNominal);
820820
Type superclassTy = type->getSuperclassForDecl(conformingClass);
821+
if (superclassTy->is<ErrorType>())
822+
return nullptr;
821823

822824
// Look up the inherited conformance.
823825
ModuleDecl *module = entry->getDeclContext()->getParentModule();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
protocol P {}
4+
protocol Q {}
5+
class A : P {}
6+
class B : A {}
7+
8+
struct A<T:B> {
9+
var x: T { fatalError("death") }
10+
}

0 commit comments

Comments
 (0)