@@ -3964,6 +3964,20 @@ namespace {
3964
3964
return nullptr ;
3965
3965
}
3966
3966
3967
+ // / Check whether there are _unsafeInheritExecutor_ workarounds in the
3968
+ // / given _Concurrency module.
3969
+ static bool hasUnsafeInheritExecutorWorkarounds (
3970
+ DeclContext *dc, SourceLoc loc
3971
+ ) {
3972
+ ASTContext &ctx = dc->getASTContext ();
3973
+ Identifier name =
3974
+ ctx.getIdentifier (" _unsafeInheritExecutor_withUnsafeContinuation" );
3975
+ NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
3976
+ LookupResult lookup = TypeChecker::lookupUnqualified (
3977
+ dc, DeclNameRef (name), loc, lookupOptions);
3978
+ return !lookup.empty ();
3979
+ }
3980
+
3967
3981
void recordCurrentContextIsolation (
3968
3982
CurrentContextIsolationExpr *isolationExpr) {
3969
3983
// If an actor has already been assigned, we're done.
@@ -3984,6 +3998,12 @@ namespace {
3984
3998
diag::isolation_in_inherits_executor,
3985
3999
inDefaultArgument);
3986
4000
diag.limitBehaviorIf (inConcurrencyModule, DiagnosticBehavior::Warning);
4001
+
4002
+ if (!inConcurrencyModule &&
4003
+ !hasUnsafeInheritExecutorWorkarounds (func, func->getLoc ())) {
4004
+ diag.limitBehavior (DiagnosticBehavior::Warning);
4005
+ }
4006
+
3987
4007
replaceUnsafeInheritExecutorWithDefaultedIsolationParam (func, diag);
3988
4008
}
3989
4009
0 commit comments