-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AnyObject removal preparations #8770
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
AnyObject removal preparations #8770
Conversation
Add a 'hasExplicitAnyObject()' bit to ProtocolCompositionType to represent canonical composition types containing '& AnyObject'. Serialize this bit and take it into account when building ExistentialLayouts. Rename ProtocolCompositionType::getProtocols() to getMembers() since it can contain classes now, and update a few usages that need further attention with FIXMEs or asserts. For now, nothing actually constructs these types, and they will trigger arounds asserts. Upcoming patches will introduce support for this.
This replaces a number of usages of KnownProtocolKind::AnyObject, which is soon going away.
There were various problems with layout constraints either being ignored or handled incorrectly. Now that I've exercised this support with an upcoming patch, there are some fixes here. Also, introduce a new ExistentialLayout::getLayoutConstriant() which returns a value for existentials which are class-constrained but don't have a superclass or any class-constrained protocols; an example would be AnyObject, or AnyObject & P for some non-class protocol P. NFC for now, since these layout-constrained existentials cannot be constructed yet.
We forgot to check for a layout constraint here.
… from inheritance clauses For now, NFC, but soon this will be <T : AnyObject>.
A protocol composition with an explicit 'AnyObject' member is now mangled as <protocol list> 'Xl'. For subclass existentials, I changed the mangling from <protocol list> <class> 'XE' to <protocol list> <class> 'Xl'. Not used for anything just yet.
Soon, Swift.AnyObject will become a protocol composition type with no protocols and a class constraint. Since there's no way to write this in the language, cons up an AnyObject type in the Builtin module, so that the standard library can define 'typealias AnyObject = Builtin.AnyObject'.
6028a3d
to
86f3464
Compare
Replace a few usages of TypeBase::getExistentialTypeProtocols(), which I'm going to remove. NFC for now, since subclass existentials are still not fully plumbed through here.
The last usages were in IRGen and they're now gone.
86f3464
to
0708323
Compare
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
Build failed |
@swift-ci Please test Linux |
Build failed |
@swift-ci Please test Linux |
Build failed |
@swift-ci Please test Linux |
This is the next step in the subclass existential saga after #8685: