Skip to content

Commit fde2016

Browse files
committed
TBDGen: Avoid crash when value witness is missing in conformance.
1 parent bc85234 commit fde2016

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/SIL/IR/SILSymbolVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
287287
rootConformance->forEachValueWitness([&](ValueDecl *valueReq,
288288
Witness witness) {
289289
auto witnessDecl = witness.getDecl();
290+
if (!witnessDecl)
291+
return;
292+
290293
if (isa<AbstractFunctionDecl>(valueReq)) {
291294
addSymbolIfNecessary(valueReq, witnessDecl);
292295
} else if (auto *storage = dyn_cast<AbstractStorageDecl>(valueReq)) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -typecheck -experimental-lazy-typecheck -emit-tbd -emit-tbd-path %t/lazy.tbd %s -enable-library-evolution -parse-as-library
3+
4+
public protocol P {
5+
func req()
6+
}
7+
8+
// FIXME: This malformed conformance should probably be diagnosed.
9+
public struct S: P {
10+
}

0 commit comments

Comments
 (0)