Skip to content

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

Merged

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 14, 2017

This is the next step in the subclass existential saga after #8685:

  • Migrate more code over to using ExistentialLayout, especially in IRGen.
  • Ensure that the recently-added generic signature layout constraints are plumbed through the right places
  • Introduce a primitive AnyObject type that will soon replace the standard library's AnyObject protocol

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'.
@slavapestov slavapestov force-pushed the anyobject-removal-preparations branch from 6028a3d to 86f3464 Compare April 14, 2017 04:17
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.
@slavapestov slavapestov force-pushed the anyobject-removal-preparations branch from 86f3464 to 0708323 Compare April 14, 2017 04:30
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 0708323
Test requested by - @slavapestov

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#181

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 0708323
Test requested by - @slavapestov

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#181

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 0708323
Test requested by - @slavapestov

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#181

@swift-ci Please test Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants