-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[1/3][Distributed] Make distributed thunks the witnesses, fix calls on generic DAs #59711
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
[1/3][Distributed] Make distributed thunks the witnesses, fix calls on generic DAs #59711
Conversation
d723fc2
to
bacc5bf
Compare
bacc5bf
to
1bfe1ca
Compare
@swift-ci please smoke test |
@swift-ci please build toolchain |
eedc751
to
203a190
Compare
@@ -4791,6 +4791,9 @@ ERROR(distributed_actor_func_static,none, | |||
ERROR(distributed_actor_func_not_in_distributed_actor,none, | |||
"'distributed' method can only be declared within 'distributed actor'", | |||
()) | |||
ERROR(distributed_method_requirement_must_be_async_throws,none, // FIXME(distributed): this is an implementation limitation we should lift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marked all sites where we emit this with rdar://95949498
203a190
to
1e87ea7
Compare
1e87ea7
to
22b20af
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits here, but overall this is an improvement and the type checker behavior accurately reflects the implementation behavior.
assert(systemTy && | ||
// NOTE: So we don't need a thunk in the protocol, we should call the underlying | ||
// thing instead, which MUST have a thunk, since it must be a distributed func as well... | ||
if (dyn_cast<ProtocolDecl>(DC)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/dyn_cast/isa/
(not important)
if (requirement.hasDecl()) { | ||
if ((!getActorIsolation(requirement.getDecl()).isDistributedActor()) || | ||
(isa<FuncDecl>(requirement.getDecl()) && | ||
witness.getFuncDecl()->isDistributed())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the last line was meant to be requirement.getFuncDecl()->isDistributed()
, i.e., is the requirement distributed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #59722
Thanks for review, will address in the 3/3 PR 👍 |
Implements calls on generic distributed actors, by fixing how the witness is found: it must be the thunk.
Resolves rdar://95829405