Skip to content

Commit d6f57c9

Browse files
committed
[Tests] NFC: Add a test-case for rdar://119593407
1 parent a7f9a68 commit d6f57c9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/Concurrency/sendable_methods.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,3 +255,25 @@ func test_initializer_ref() {
255255
test(initRef) // Ok
256256
test(Array<Int>.init) // Ok
257257
}
258+
259+
// rdar://119593407 - incorrect errors when partially applied member is accessed with InferSendableFromCaptures
260+
do {
261+
@MainActor struct ErrorHandler {
262+
static func log(_ error: Error) {}
263+
}
264+
265+
@MainActor final class Manager {
266+
static var shared: Manager!
267+
268+
func test(_: @escaping @MainActor (Error) -> Void) {
269+
}
270+
}
271+
272+
@MainActor class Test {
273+
func schedule() {
274+
Task {
275+
Manager.shared.test(ErrorHandler.log) // Ok (access is wrapped in an autoclosure)
276+
}
277+
}
278+
}
279+
}

0 commit comments

Comments
 (0)