Skip to content

Commit bc58dd5

Browse files
authored
Merge pull request #68007 from ktoso/pick-wip-null-witness-executor
[5.9][Executors] tryDiagnoseExecutor must survive null witness, when using Backdeploy library
2 parents 7651a7f + 29f1c42 commit bc58dd5

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
@@ -1367,6 +1367,9 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,
13671367

13681368
auto concurrencyModule = C.getLoadedModule(C.Id_Concurrency);
13691369
auto isStdlibDefaultImplDecl = [executorDecl, concurrencyModule](ValueDecl *witness) -> bool {
1370+
if (!witness)
1371+
return false;
1372+
13701373
if (auto declContext = witness->getDeclContext()) {
13711374
if (auto *extension = dyn_cast<ExtensionDecl>(declContext)) {
13721375
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)