[6.2][rbi] Lookthrough an invocation of DistributedActor.asLocalActor when determining actor instances. #81943
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: This PR makes it so that when identifying actor instances we look through DistributedActor.asLocalActor. The reason why we need to do this 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.
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.
Scope: This just changes how we handle in SIL a specific call inserted by the distributed runtime. Will not impact any other code.
Resolves: rdar://152436817
Main PR: #81909
Risk: Low. This only changes how we handle in SIL a specific call inserted by the distributed runtime. Any other code will not be impacted by this change.
Testing: Added compiler tests
Reviewer: @ktoso