-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.6][SE-0335] Enable explicit existential types. #40804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.6][SE-0335] Enable explicit existential types. #40804
Conversation
compositions in ExistentialType when explicit existentials are enabled.
type resolver context.
in ExistentialType for the type of error values.
existential types.
…able initializer requirements with explicit existential Encodable and Decodable parameters.
the ClangImporter.
finding the protocol decl for an existential type.
explicit ExistentialType. The ASTDemangler needs to produce ExistentialType based on context, not unconditionally when producing a protocol composition. This is tricky because existential types are mangled the same way as other protocol references, e.g. in conformance requirements. For now, drop the explicit existentials when reconstructing types.
must be marked with 'any' as a warning.
resolve to ProtocolType or ProtocolCompositionType are always existential types. This can happen because type aliases to protocol constraints can also be used as type witnesses. The type alias itself is still a constraint, because it can be used in generic signatures in addition to being used as an existential type, e.g. in parameter position. So, we need to wrap the type alias in an ExistentialType during type witness resolution.
metatypes always wrap the constraint type directly, and the instance type of an existential metatype is an existential type.
…icit existential types.
existential types. Use the correct type resolver context when resolving SIL metatypes and function types, and diagnose an error if an explicit existential type appears in a protocol composition.
various places that expect ProtocolType or ProtocoolCompositionType.
are printed with the `any` keyword. For now, printing `any` is off by default in order to turn on explicit existential types with minimal changes to the test suite. The option will also allow control over how existential types are printed in Swift interfaces.
explicit existential types are enabled.
There are places in the frontend that strip off ExistentialType from a type, e.g. in the round-trip check for type reconstruction, which is a valid transformation for SILBox types' substitutions because it doesn't invalidate conformances.
@swift-ci please test |
@swift-ci please test source compatibility |
…Type by propagating whether the decoded type is for a requirement through TypeDecoder.
@swift-ci please test |
@swift-ci please test source compatibility |
Build failed |
None of the source compatibility failures look related to this change. All of the failing projects are XFAIL'd on main, and from what I can tell, the failures are the same here as they were with main. |
@swift-ci please test macOS platform |
Build failed |
@swift-ci please test macOS platform |
Build failed |
@swift-ci please clean test macOS platform |
existential arguments to not return before checking the second argument type.
…ence when the member is a typealias to a protocol or composition.
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please clean test Linux platform |
Cherry-pick of #40666
This change is critical for Swift 5.6 in order to stage in the transition to
any
over several major releases. This change allowsany
to be written in source code, but does not introduce warnings about the lack ofany
, per the acceptance decision of SE-0335:Resolves: rdar://86347236