-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0313] isolated parameters ABI #37944
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
DougGregor
merged 8 commits into
swiftlang:release/5.5
from
DougGregor:isolated-parameters-abi
Jun 16, 2021
Merged
[SE-0313] isolated parameters ABI #37944
DougGregor
merged 8 commits into
swiftlang:release/5.5
from
DougGregor:isolated-parameters-abi
Jun 16, 2021
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
(cherry picked from commit bd8626f)
…ated'. The notion of "actor-isolated" currently exists at the declaration level. For functions, it is going to be captured in the function type itself, where 'self' is declared to be 'isolated'. Model isolation both ways: the 'self' of a method that is isolated to an actor instance will be 'isolated' as well. We are still using declaration-based checking of actor isolation. However, by mirroring this information we can move more incrementally over to doing checking based on 'isolated' parameters. (cherry picked from commit 5004a54)
With isolated parameters being part of a function's type, check to ensure that isolated and non-isolated parameters aren't incorrectly matched. Specifically, it is okay to add `isolated` to a parameter when there is a subtyping relationship, but not remove it: ```swift actor A { } func f(_: isolated A) { } func g(_: A) { } func test() { let _: (isolated A) -> Void = g // okay to add 'isolated' let _: (A) -> Void = f // error when removing 'isolated' } ``` (cherry picked from commit 4afa371)
…ers. Isolated parameters are part of function types. Encode them in function type manglings and metadata, and ensure that they round-trip through the various mangling and metadata facilities. This nails down the ABI for isolated parameters. (cherry picked from commit 58f4969)
Rework the checking of actor member access to rely on "isolated" parameters (and captures thereof) to determine whether one can synchronously access an actor or not. This allows synchronous access via an "isolated" parameter as a general notion, which subsumes the declaration-based "self" access. Simplify the checking of and diagnostic reporting for actor member access by collapsing a number of redundant diagnostics down into a single, parameterized diagnostic with a single point of emission. This normalizes the logic a bit. (cherry picked from commit 5bcd5a8)
(cherry picked from commit 4bcd74e)
Fixes a regression I introduced recently, rdar://79200626. (cherry picked from commit caf843f)
@swift-ci please test |
Build failed |
Grrr. Unrelated failure on Linux |
@swift-ci please test Linux |
@swift-ci please nominate |
airspeedswift
approved these changes
Jun 16, 2021
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.
Explanation: Implements the core type checker, runtime, and ABI aspects of
isolated
parameters for SE-0313, so we can lock in the mangling and runtime representation for this feature.Scope: Affects the modeling of actors in the type system, but should not change the semantics.
Radar/SR Issue: rdar://75389492
Risk: Low.
Testing: PR testing and CI on main.
Original PR: #37794