`any P` check doesn't work for standard library protocols

I recently enabled --enable-upcoming-feature ExistentialAny in my project. It produced a lot of compiled error, but after adding any they are resolved as expected.
After a while, I noticed there are still overlooked bare protocol.

For example, this is one of the cases.

init(from decoder: Decoder) throws { /* ... */ }

It should be init(from decoder: any Decoder), but it does not produce compile error.

As I checked, it seems any P check is not working for standard library protocols without associated types Codable, Decoder, Encoder, CustomStringConvertible, CustomDebugStringConvertible, ExpressibleBy*Literal, and so on.

Is it a bug, or intended behavior?


  • Xcode Version 14.3 (14E222b)
  • swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang- clang-1403., Target: x86_64-apple-macosx13.0

I've opened an issue.

1 Like