[Concurrency] tighten-up rules about isolated generic parameters #68612
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.
[Concurrency] tighten-up rules about isolated generic parameters
We were missing a check for conformance to
Actor
orDistributedActor
when an isolated parameter's type is a generic parameter.
Previously, if you used a generic parameter constrained to just
AnyActor
,you'd crash the compiler in LowerHopToExecutor because it doesn't know
how to obtain the executor for such a value. Since
AnyActor
has nounownedExecutor
requirement, there's no way to get the executor withoutemitting code to do dynamic casts down to
Actor
orDistributedActor
.Rather than have the compiler silently emit dynamic casting, I figured
it's best to ban it. This forces people to either do the dynamic casts
themselves, or use one of the more specific types to constrain their
parameter.
For other generic parameters, we would silently treat the function
as though it is nonisolated (i.e., as if the
isolated
wasn't writtenon the parameter at all).
resolves rdar://109059544