@@ -675,10 +675,6 @@ static bool isSendableClosure(
675
675
if (forActorIsolation && explicitClosure->inheritsActorContext ()) {
676
676
return false ;
677
677
}
678
-
679
- if (explicitClosure->isIsolatedByPreconcurrency () &&
680
- !shouldDiagnoseExistingDataRaces (closure->getParent ()))
681
- return false ;
682
678
}
683
679
684
680
if (auto type = closure->getType ()) {
@@ -3692,13 +3688,16 @@ namespace {
3692
3688
bool checkLocalCapture (
3693
3689
ConcreteDeclRef valueRef, SourceLoc loc, DeclRefExpr *declRefExpr) {
3694
3690
auto value = valueRef.getDecl ();
3691
+ auto *dc = getDeclContext ();
3695
3692
3696
3693
// Check whether we are in a context that will not execute concurrently
3697
3694
// with the context of 'self'. If not, it's safe.
3698
- if (!mayExecuteConcurrentlyWith (
3699
- getDeclContext (), findCapturedDeclContext (value)))
3695
+ if (!mayExecuteConcurrentlyWith (dc, findCapturedDeclContext (value)))
3700
3696
return false ;
3701
3697
3698
+ SendableCheckContext sendableBehavior (dc);
3699
+ auto limit = sendableBehavior.defaultDiagnosticBehavior ();
3700
+
3702
3701
// Check whether this is a local variable, in which case we can
3703
3702
// determine whether it was safe to access concurrently.
3704
3703
if (auto var = dyn_cast<VarDecl>(value)) {
@@ -3738,7 +3737,7 @@ namespace {
3738
3737
loc, diag::concurrent_access_of_local_capture,
3739
3738
parent.dyn_cast <LoadExpr *>(),
3740
3739
var)
3741
- .warnUntilSwiftVersion ( 6 );
3740
+ .limitBehaviorUntilSwiftVersion (limit, 6 );
3742
3741
return true ;
3743
3742
}
3744
3743
@@ -3748,7 +3747,7 @@ namespace {
3748
3747
3749
3748
func->diagnose (diag::local_function_executed_concurrently, func)
3750
3749
.fixItInsert (func->getAttributeInsertionLoc (false ), " @Sendable " )
3751
- .warnUntilSwiftVersion ( 6 );
3750
+ .limitBehaviorUntilSwiftVersion (limit, 6 );
3752
3751
3753
3752
// Add the @Sendable attribute implicitly, so we don't diagnose
3754
3753
// again.
0 commit comments