[rbi] Lookthrough an invocation of DistributedActor.asLocalActor when determining actor instances. #81909
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.
In this case, what is happening is that in SILGen, we insert implicit DistributedActor.asLocalActor calls to convert a distributed actor to its local any Actor typed form. The intention is that the actor parameter and result are considered the same... but there is nothing at the SIL level to enforce that. In this commit, I change ActorInstance (the utility that defines actor identity at a value level) to look through such a call.
I implemented this by just recognizing the decl directly. We already do this in parts of SILGen, so I don't really see a problem with doing this. It also provides a nice benefit that we do not have to modify SILFunctionType to represent this or put a @_semantic attribute on the getter.
NOTE: Generally, Sema prevents us from mixing together different actors. In this case, Sema does not help us since this call is inserted implicitly by the distributed actor implementation in SILGen. So this is not a problem in general.
rdar://152436817