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?
Environment
- Xcode Version 14.3 (14E222b)
- swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100), Target: x86_64-apple-macosx13.0