Skip to content

Commit e06a6c7

Browse files
Merge pull request swiftlang#78902 from AnthonyLatsis/rdar136766795
test: Add regression test for rdar://136766795
2 parents 5ee97c5 + 767c3ff commit e06a6c7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Concurrency/sendable_checking_captures_swift5.swift

+25
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,28 @@ func testPreconcurrencyDowngrade(ns: NotSendable) {
6969
// expected-complete-warning@-1 {{mutation of captured var 'x' in concurrently-executing code}}
7070
}
7171
}
72+
73+
// rdar://136766795
74+
do {
75+
class Class {
76+
static func test() -> @Sendable () -> Void {
77+
{
78+
// OK, an unbound reference is sendable.
79+
let _ = Class.method
80+
}
81+
}
82+
83+
func method() {}
84+
}
85+
}
86+
87+
do {
88+
class Class {}
89+
// expected-complete-note@-1 {{class 'Class' does not conform to the 'Sendable' protocol}}
90+
91+
func test(_: @autoclosure @Sendable () -> Class) {}
92+
93+
let c: Class
94+
test(c)
95+
// expected-complete-warning@-1:8 {{implicit capture of 'c' requires that 'Class' conforms to `Sendable`; this is an error in the Swift 6 language mode}}
96+
}

0 commit comments

Comments
 (0)