File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
3838 public static func startSynchronously(
3939 name: String? = nil,
4040 priority: TaskPriority? = nil,
41- @_inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async throws -> Success
41+ @_implicitSelfCapture @ _inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async throws -> Success
4242 ) -> Task<Success, ${FAILURE_TYPE}> {
4343 immediate(name: name, priority: priority, operation: operation)
4444 }
@@ -73,7 +73,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
7373 priority: TaskPriority? = nil,
7474 % # NOTE: This closure cannot be 'sending' because we'll trigger ' pattern that the region based isolation checker does not understand how to check'
7575 % # In this case: `func syncOnMyGlobalActor() { Task.immediate { @MyGlobalActor in } }`
76- @_inheritActorContext(always) operation: sending @isolated(any) @escaping () async throws -> Success
76+ @_implicitSelfCapture @ _inheritActorContext(always) operation: sending @isolated(any) @escaping () async throws -> Success
7777 ) -> Task<Success, ${FAILURE_TYPE}> {
7878
7979 let builtinSerialExecutor =
Original file line number Diff line number Diff line change @@ -38,3 +38,14 @@ func async() async throws {
3838 group. addImmediateTaskUnlessCancelled { ( ) async throws -> Void in }
3939 }
4040}
41+
42+ @available ( SwiftStdlib 6 . 2 , * )
43+ actor TestSelfCapture {
44+ func method( ) { }
45+
46+ func test( ) {
47+ Task . immediate {
48+ method ( ) // Ok due to `@_implicitSelfCapture`
49+ }
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments