Skip to content

[DNM][Distributed] Handle generic actors and Codable better #71467

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

Closed
wants to merge 9 commits into from

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Feb 8, 2024

This builds on top of #71435

And adds the last commit which cleans up our "implicit codable" logic.
I think this is probably good enough tbh -- see test cases @xedin

The commit: 5f669bb

xedin added 6 commits February 7, 2024 21:10
…computeSubstitutions`

This is going to be used to determine whether the substitutions are
computed for `DistributedActorSystem::remoteCall` and adjust the
generic signature with witness conformance requirements.
…f `DistributedActorSystem.remoteCall`

Conformance requirement between on `Res` and `SerializationRequirement`
of `DistributedActorSystem.remoteCall` are not expressible at the moment
but they are verified by Sema so it's okay to omit them here and lookup
dynamically during IRGen.
…tedActorSystem.remoteCall` witnesses

When IRGen is building a protocol witness thunk for a
`DistributedActorSystem.remoteCall` requirement we
need to supply witness tables associated with `Res`
generic parameter which are not expressible on the
requirement because they come from `SerializationRequirement`
associated type.
@ktoso ktoso added the distributed Feature → concurrency: distributed actor label Feb 9, 2024
@ktoso
Copy link
Contributor Author

ktoso commented Feb 14, 2024

@swift-ci please smoke test

@@ -763,6 +762,30 @@ addDistributedActorCodableConformance(
return nullptr;
}

if (actor->isGeneric()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want isGeneric() or isGenericContext()?


assert(proto->isSpecificProtocol(swift::KnownProtocolKind::Decodable) ||
proto->isSpecificProtocol(swift::KnownProtocolKind::Encodable));

// === Does the actor explicitly conform to the protocol already?
auto explicitConformance =
module->lookupConformance(actor->getInterfaceType(), proto);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always return false because getInterfaceType() returns a metatype given a TypeDecl

@ktoso
Copy link
Contributor Author

ktoso commented Feb 15, 2024

Thanks Slava, I'll be looking into this one deeper next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants