Skip to content

Commit 7cdeda7

Browse files
committed
[Distributed] Another fix for getting required protocols for SR
1 parent 332e20f commit 7cdeda7

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

include/swift/AST/ASTSynthesis.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ enum SingletonTypeSynthesizer {
4141
_any,
4242
_bridgeObject,
4343
_error,
44-
_executor, // the 'BuiltinExecutor' type
44+
_executor,
4545
_job,
4646
_nativeObject,
4747
_never,
4848
_rawPointer,
4949
_rawUnsafeContinuation,
5050
_void,
5151
_word,
52-
_executorProtocol, // the '_Concurrency.Executor' protocol
53-
_serialExecutor, // the '_Concurrency.SerialExecutor' protocol
52+
_serialExecutor,
5453
};
5554
inline Type synthesizeType(SynthesisContext &SC,
5655
SingletonTypeSynthesizer kind) {
@@ -67,15 +66,9 @@ inline Type synthesizeType(SynthesisContext &SC,
6766
case _void: return SC.Context.TheEmptyTupleType;
6867
case _word: return BuiltinIntegerType::get(BuiltinIntegerWidth::pointer(),
6968
SC.Context);
70-
case _executorProtocol:
71-
return SC.Context.getProtocol(KnownProtocolKind::Executor)
72-
->getDeclaredInterfaceType();
73-
case _serialExecutor:
69+
case _serialExecutor:
7470
return SC.Context.getProtocol(KnownProtocolKind::SerialExecutor)
7571
->getDeclaredInterfaceType();
76-
case _taskExecutor:
77-
return SC.Context.getProtocol(KnownProtocolKind::TaskExecutor)
78-
->getDeclaredInterfaceType();
7972
}
8073
}
8174

lib/AST/DistributedDecl.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,8 @@ Type swift::getSerializationRequirementTypesForMember(
119119
}
120120

121121
// Also store all `SerializationRequirement : SomeProtocol` requirements
122-
for (auto requirement: signature.getRequirements()) {
123-
if (requirement.getFirstType()->isEqual(SerReqAssocType) &&
124-
requirement.getKind() == RequirementKind::Conformance) {
125-
if (auto nominal = requirement.getSecondType()->getAnyNominal()) {
126-
if (auto protocol = dyn_cast<ProtocolDecl>(nominal)) {
127-
serializationRequirements.insert(protocol);
128-
}
129-
}
130-
}
122+
for (auto proto: signature->getRequiredProtocols(SerReqAssocType)) {
123+
serializationRequirements.insert(proto);
131124
}
132125

133126
// Note that this may be null, e.g. if we're a distributed func inside

0 commit comments

Comments
 (0)