TBDGen: Avoid crash when value witness is missing in conformance.

This commit is contained in:
Allan Shortlidge
2023-08-30 11:39:55 -07:00
parent bc85234e5b
commit fde20160d3
2 changed files with 13 additions and 0 deletions

View File

@@ -287,6 +287,9 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
rootConformance->forEachValueWitness([&](ValueDecl *valueReq,
Witness witness) {
auto witnessDecl = witness.getDecl();
if (!witnessDecl)
return;
if (isa<AbstractFunctionDecl>(valueReq)) {
addSymbolIfNecessary(valueReq, witnessDecl);
} else if (auto *storage = dyn_cast<AbstractStorageDecl>(valueReq)) {

View File

@@ -0,0 +1,10 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -experimental-lazy-typecheck -emit-tbd -emit-tbd-path %t/lazy.tbd %s -enable-library-evolution -parse-as-library
public protocol P {
func req()
}
// FIXME: This malformed conformance should probably be diagnosed.
public struct S: P {
}