The following "escapes" the MainActor isolated conformance of K to P, incorrectly allowing it to be used in a non-isolated context:
protocol P {
static func foo()
}
struct S<T: P>: P {
static func foo() { T.foo() }
}
@MainActor struct K: @MainActor P {
static func foo() {
MainActor.preconditionIsolated("💥")
}
}
await Task.detached {
let x = S<K>.self
(x as P.Type).foo()
}.value
The following "escapes" the
MainActorisolated conformance ofKtoP, incorrectly allowing it to be used in a non-isolated context: