Skip to content

[5.9][Executors] tryDiagnoseExecutor must survive null witness, when using Backdeploy library #68007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,9 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,

auto concurrencyModule = C.getLoadedModule(C.Id_Concurrency);
auto isStdlibDefaultImplDecl = [executorDecl, concurrencyModule](ValueDecl *witness) -> bool {
if (!witness)
return false;

if (auto declContext = witness->getDeclContext()) {
if (auto *extension = dyn_cast<ExtensionDecl>(declContext)) {
auto extensionModule = extension->getParentModule();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

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

public struct UnownedJob {}

public protocol SerialExecutor {
// pretend to be a broken, empty serial executor
public protocol Executor {
func enqueue(_ job: UnownedJob)
}
}
public protocol SerialExecutor: Executor { }