mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Fix how we obtain DA-as-A conformance for cross module
Resolves rdar://127206143
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "CodeSynthesis.h"
|
||||
#include "DerivedConformances.h"
|
||||
#include "TypeCheckType.h"
|
||||
#include "TypeChecker.h"
|
||||
#include "swift/AST/ASTMangler.h"
|
||||
#include "swift/AST/ASTPrinter.h"
|
||||
@@ -1066,3 +1065,30 @@ bool CanSynthesizeDistributedActorCodableConformanceRequest::evaluate(
|
||||
TypeChecker::conformsToKnownProtocol(
|
||||
idTy, KnownProtocolKind::Encodable, actor->getParentModule());
|
||||
}
|
||||
|
||||
NormalProtocolConformance *
|
||||
GetDistributedActorAsActorConformanceRequest::evaluate(
|
||||
Evaluator &evaluator, ProtocolDecl *distributedActorProto) const {
|
||||
auto &ctx = distributedActorProto->getASTContext();
|
||||
auto swiftModule = ctx.getStdlibModule();
|
||||
|
||||
auto actorProto = ctx.getProtocol(KnownProtocolKind::Actor);
|
||||
|
||||
auto ext = findDistributedActorAsActorExtension(
|
||||
distributedActorProto, swiftModule);
|
||||
if (!ext)
|
||||
return nullptr;
|
||||
|
||||
auto genericParam = GenericTypeParamType::get(/*isParameterPack=*/false,
|
||||
/*depth=*/0, /*index=*/0, ctx);
|
||||
|
||||
auto distributedActorAsActorConformance = ctx.getNormalConformance(
|
||||
Type(genericParam), actorProto, SourceLoc(), ext,
|
||||
ProtocolConformanceState::Incomplete, /*isUnchecked=*/false,
|
||||
/*isPreconcurrency=*/false);
|
||||
// NOTE: Normally we "register" a conformance, but here we don't
|
||||
// because we cannot (currently) register them in a protocol,
|
||||
// since they do not have conformance tables.
|
||||
|
||||
return distributedActorAsActorConformance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user