Skip to content

Commit 7ab6554

Browse files
authored
Merge pull request #39145 from DougGregor/new-concurrency-5.5-compiler
2 parents bd5b301 + a6c88ee commit 7ab6554

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
370370
interleave(RenderedArgs,
371371
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
372372
[&] { OS << " "; });
373+
374+
// Backward-compatibility hack: disable availability checking in the
375+
// _Concurrency module, so that older (Swift 5.5) compilers that did not
376+
// support back deployment of concurrency do not complain about 'async'
377+
// with older availability.
378+
if (FOpts.ModuleName == "_Concurrency")
379+
OS << " -disable-availability-checking";
373380
}
374381
{
375382
llvm::raw_string_ostream OS(Opts.IgnorableFlags);

stdlib/public/Concurrency/Task.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,14 @@ func _getCurrentThreadPriority() -> Int
824824
@_alwaysEmitIntoClient
825825
@usableFromInline
826826
internal func _runTaskForBridgedAsyncMethod(@_inheritActorContext _ body: __owned @Sendable @escaping () async -> Void) {
827+
#if compiler(>=5.6)
827828
Task(operation: body)
829+
#else
830+
Task<Int, Error> {
831+
await body()
832+
return 0
833+
}
834+
#endif
828835
}
829836

830837
#endif

0 commit comments

Comments
 (0)