-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-327] Remove need for convenience
for delegating initializers of an actor.
#41083
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
358b4d2
to
5445923
Compare
cf1feb1
to
0c92169
Compare
0c92169
to
5b14344
Compare
d259422
to
02f1d51
Compare
@swift-ci please smoke test |
02f1d51
to
47cf9d1
Compare
@swift-ci please smoke test |
47cf9d1
to
6b5f074
Compare
This is possible because actors do not support inheritance. There is one specific exception to that rule, which is that an actor can inherit from `NSObject` just to support ObjC interop. This means an actor is effectively a final class. resolves rdar://87568153
When synthesizing the default initializer for an actor, we'd sometimes hit a cycle when that initializer needs to chain to NSObject.init. The cycle only happens because we ask if the initializer we're trying to synthesize is a convenience init in a scenario which only applies to non-final classes. Since all actors are effectively "final" classes, it's valid to workaround the cycle by only asking that initializer question for non-final classes, thus breaking the cycle.
6b5f074
to
cf637c2
Compare
it should not matter whether an initializer is delegating or not when importing a library. this test helps make sure that stays true.
@swift-ci please test and merge |
The Linux issue is legitimate:
|
@swift-ci please test |
1 similar comment
@swift-ci please test |
071e388
to
cf7a99d
Compare
@swift-ci please test and merge |
@swift-ci please test just want to cancel the merge so i can add another change |
ac43753
to
d4a1ab8
Compare
A public designated initializer of a class would have its allocating entry-point serialized in the module, meaning with `-O` that entry-point can get inlined into programs linking against that module. Once that entry-point is inlined, the program will _require_ that it remain non-delegating, because it will depend on the 2nd entry-point (for actual initializing) to be in the library. As a result of this change, public initializers of an actor should be resilient in a library, whether their underlying implementation is delegating or not.
d4a1ab8
to
2e865c8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For more details: https://github.com/apple/swift-evolution/blob/main/proposals/0327-actor-initializers.md#syntactic-form
Resolves rdar://87568153
TODOs:
SILInitializerConventions.rst