Closed as duplicate of#82116
Description
Description
Swift 6.2 seems to be incorrectly warning when referencing a generic type in a closure
Reproduction
public protocol ArgumentReceiving {
associatedtype Arguments
}
public final class DeferredInitializer<T: ArgumentReceiving>: Sendable {
public init(_ initializer: @escaping @Sendable (T.Arguments) -> T) {
self.initializer = { initializer($0) } // WARNING: Capture of non-sendable type 'T.Type' in an isolated closure
// self.initializer = initializer // When uncommented (and the prior line is commented out) this line builds without warning, as expected.
}
private let initializer: @Sendable (T.Arguments) -> T
}
Expected behavior
No warning emitted
Environment
Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Target: arm64-apple-macosx15.0
/Applications/Xcode-26.0.0-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-help intro
Additional information
No response