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