Because conformance to AnyObject is not the same as subtyping of any AnyObject, SF-0011 does not allow to use existentials of AnyObject-constrained protocols as Subject, unless they are marked as @objc.
protocol MySubject: AnyObject {
}
struct MyMessage: NotificationCenter.AsyncMessage {
typealias Subject = any MySubject
}
class C: MySubject {
private func notify() {
// error: No exact matches in call to instance method 'post'
NotificationCenter.default.post(MyMessage(), subject: self)
}
}