SIL: Skip visiting bad extensions in SILSymbolVisitor.

When lazy typechecking is enabled, extensions that do not typecheck can make it
to TBDGen, which would crash during its AST walk because `SILSymbolVisitor`
tried to dereference the null nominal type for the extension.

Resolves rdar://139320515.
This commit is contained in:
Allan Shortlidge
2024-11-12 17:22:51 -08:00
parent 9e5a105644
commit 74035acecd
2 changed files with 7 additions and 0 deletions

View File

@@ -735,6 +735,9 @@ public:
void visitExtensionDecl(ExtensionDecl *ED) {
auto nominal = ED->getExtendedNominal();
if (!nominal)
return;
if (canSkipNominal(nominal))
return;

View File

@@ -8,3 +8,7 @@ public protocol P {
// expected-error@+1 {{type 'S' does not conform to protocol 'P'}}
public struct S: P {
}
extension DoesNotExist {
public func method() {}
}