Skip to content

Commit 13605b8

Browse files
committed
[Executors] isStdlibDefaultImplDecl must guard from null values, coming from Backdeploy library
resolves rdar://114029779
1 parent 74a5a5e commit 13605b8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,9 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,
13601360

13611361
auto concurrencyModule = C.getLoadedModule(C.Id_Concurrency);
13621362
auto isStdlibDefaultImplDecl = [executorDecl, concurrencyModule](ValueDecl *witness) -> bool {
1363+
if (!witness)
1364+
return false;
1365+
13631366
if (auto declContext = witness->getDeclContext()) {
13641367
if (auto *extension = dyn_cast<ExtensionDecl>(declContext)) {
13651368
auto extensionModule = extension->getParentModule();
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11

22
// This simulates a pre-Swift5.9 concurrency library with `Job` and `ExecutorJob` not being defined at all.
33
// This is used to verify missing type handling in the SDK when a latest compiler is used.
4+
//
5+
// This also looks exactly like the Back deployment library which also does not
6+
// know about Job, and therefore is missing the Job based (and ExecutorJob based),
7+
// protocol requirements. This helps confirm we don't crash assuming that those
8+
// protocol requirements would always be there.
49

510
public struct UnownedJob {}
611

7-
public protocol SerialExecutor {
8-
// pretend to be a broken, empty serial executor
12+
public protocol Executor {
913
func enqueue(_ job: UnownedJob)
10-
}
14+
}
15+
public protocol SerialExecutor: Executor { }

0 commit comments

Comments
 (0)