Open
Description
Description
With Xcode 26.0 beta (17A5241e), I see a lot of warnings:
- Capture of non-sendable type 'Aggregate.Type' in an isolated closure
- Capture of non-sendable type 'Downstream.Type' in an isolated closure
- Capture of 'recordType' with non-sendable type 'any EncodableRecord.Type' in a '@sendable' closure
- Capture of non-sendable type 'Self.Type' in an isolated closure
Those warnings make no sense: meta-types are Sendable.
EDIT: I initially missed the existence of SE-0470, which introduces non-sendable meta-types. In this issue, the IsolatedConformances
and StrictSendableMetatypes
experimental features are not enabled. Package.swift mentions swift-tools-version:6.0
or 6.1
.
Reproduction
protocol MyProtocol1 { init() }
struct MyStruct<T> {
var x: @Sendable () -> T.Type
}
func f<T: MyProtocol1>(_ type: T.Type) {
// ⚠️ Capture of non-sendable type 'T.Type' in an isolated closure
MyStruct { T.self }
}
protocol MyProtocol2 {
associatedtype Value
}
func f<T: MyProtocol2>(
_ type: T.Type,
// ⚠️ Capture of non-sendable type 'T.Type' in an isolated closure
closure: @escaping @Sendable (T.Value.Type) -> Void
) {
Task {
closure(T.Value.self)
}
}
Expected behavior
No warning
Environment
Version 26.0 beta (17A5241e)
Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Additional information
No response