Skip to content

Commit afa1e28

Browse files
authored
Downgrade missing @Sendable error on local functions to a warning. (#58803)
We're staging in most of these checks via warnings in Swift 5.x. Fixes rdar://92986898.
1 parent 47d7d8c commit afa1e28

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,8 @@ namespace {
26522652
func->diagnose(
26532653
diag::local_function_executed_concurrently,
26542654
func->getDescriptiveKind(), func->getName())
2655-
.fixItInsert(func->getAttributeInsertionLoc(false), "@Sendable ");
2655+
.fixItInsert(func->getAttributeInsertionLoc(false), "@Sendable ")
2656+
.warnUntilSwiftVersion(6);
26562657

26572658
// Add the @Sendable attribute implicitly, so we don't diagnose
26582659
// again.

test/Concurrency/actor_isolation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ func checkLocalFunctions() async {
690690
i = 17
691691
}
692692

693-
func local2() { // expected-error{{concurrently-executed local function 'local2()' must be marked as '@Sendable'}}{{3-3=@Sendable }}
693+
func local2() { // expected-warning{{concurrently-executed local function 'local2()' must be marked as '@Sendable'}}{{3-3=@Sendable }}
694694
j = 42
695695
}
696696

@@ -721,7 +721,7 @@ func checkLocalFunctions() async {
721721
}
722722
}
723723

724-
func local3() { // expected-error{{concurrently-executed local function 'local3()' must be marked as '@Sendable'}}
724+
func local3() { // expected-warning{{concurrently-executed local function 'local3()' must be marked as '@Sendable'}}
725725
k = 25 // expected-error{{mutation of captured var 'k' in concurrently-executing code}}
726726
}
727727

0 commit comments

Comments
 (0)