Skip to content

test: Add regression test for rdar://136766795 #78902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/Concurrency/sendable_checking_captures_swift5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,28 @@ func testPreconcurrencyDowngrade(ns: NotSendable) {
// expected-complete-warning@-1 {{mutation of captured var 'x' in concurrently-executing code}}
}
}

// rdar://136766795
do {
class Class {
static func test() -> @Sendable () -> Void {
{
// OK, an unbound reference is sendable.
let _ = Class.method
}
}

func method() {}
}
}

do {
class Class {}
// expected-complete-note@-1 {{class 'Class' does not conform to the 'Sendable' protocol}}

func test(_: @autoclosure @Sendable () -> Class) {}

let c: Class
test(c)
// 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}}
}