The any MyProtocol
syntax may not be possible, due to the global any(_:)
function:
Any & MyProtocol
is already permitted, so could this be a backwards-compatible syntax for existential types? The compiler might generate a warning and fix-it in Swift 5.x, followed by an error in Swift 6 or later?
However, MemoryLayout<Any & MyProtocol>.size
doesn't compile in Swift 5.5 — a workaround is to use a typealias of the protocol composition.