Skip to content

Commit 74035ac

Browse files
committed
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.
1 parent 9e5a105 commit 74035ac

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/SIL/IR/SILSymbolVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,9 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
735735

736736
void visitExtensionDecl(ExtensionDecl *ED) {
737737
auto nominal = ED->getExtendedNominal();
738+
if (!nominal)
739+
return;
740+
738741
if (canSkipNominal(nominal))
739742
return;
740743

test/TBD/lazy-typecheck-bad-conformance.swift renamed to test/TBD/lazy-typecheck-errors.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ public protocol P {
88
// expected-error@+1 {{type 'S' does not conform to protocol 'P'}}
99
public struct S: P {
1010
}
11+
12+
extension DoesNotExist {
13+
public func method() {}
14+
}

0 commit comments

Comments
 (0)