Avatar
@swift-main -swift-version 6 protocol P { static func doSomething() } struct S: @MainActor P { static func doSomething() { MainActor.assertIsolated() } } struct S2: P { static func doSomething() {} } func useSendable(_ v: some Sendable) { Task.detached { if let v = v as? any P.Type { v.doSomething() print(v, "is P.Type") } else { print(v, "is not P.Type") } } } func useP(_ v: any P.Type) { useAny(v) } func useAny(_ v: Any.Type) { useSendable(v) } useP(S2.self) useP(S.self) (edited)