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} {
38
38
public static func startSynchronously(
39
39
name: String? = nil,
40
40
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
42
42
) -> Task<Success, ${FAILURE_TYPE}> {
43
43
immediate(name: name, priority: priority, operation: operation)
44
44
}
@@ -73,7 +73,7 @@ extension Task where Failure == ${FAILURE_TYPE} {
73
73
priority: TaskPriority? = nil,
74
74
% # NOTE: This closure cannot be 'sending' because we'll trigger ' pattern that the region based isolation checker does not understand how to check'
75
75
% # 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
77
77
) -> Task<Success, ${FAILURE_TYPE}> {
78
78
79
79
let builtinSerialExecutor =
Original file line number Diff line number Diff line change @@ -38,3 +38,14 @@ func async() async throws {
38
38
group. addImmediateTaskUnlessCancelled { ( ) async throws -> Void in }
39
39
}
40
40
}
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