-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Description
marking a static function in a protocol as @Sendable causes the compiler to emit a warning "Instance method of non-Sendable type 'Self.Type' cannot be marked as '@sendable'", which doesn't seem to be correct since a) the method in question is a static method rather than an instance method, and b) it's irrelevant if the type is Sendable (bc it's a static method...)
Reproduction
protocol P {
@Sendable static func f()
// ^ Instance method of non-Sendable type 'Self.Type' cannot be marked as '@Sendable'
}Expected behavior
this should work without warnings
Environment
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx15.0
Additional information
i'm able to reproduce this when compiling an SPM package using swift build and when compiling via Xcode, but it seems that using either swiftc or swift to compile just a single file containing just this protocol definition compiles without emitting the warning