@@ -341,11 +341,12 @@ swift::getDistributedSerializationRequirements(
341
341
return true ; // we're done here, any means there are no requirements
342
342
343
343
auto *serialReqType = existentialRequirementTy->getAs <ExistentialType>();
344
+ ->getAs <ExistentialType>();
344
345
if (!serialReqType || serialReqType->hasError ()) {
345
346
return false ;
346
347
}
347
348
348
- auto layout = serialReqType->getExistentialLayout ();
349
+ auto desugaredTy = serialReqType->getConstraintType ();
349
350
for (auto p : layout.getProtocols ()) {
350
351
requirementProtos.insert (p);
351
352
}
@@ -1224,15 +1225,25 @@ swift::extractDistributedSerializationRequirements(
1224
1225
DA->getAssociatedType (C.Id_SerializationRequirement );
1225
1226
1226
1227
for (auto req : allRequirements) {
1227
- // FIXME: Seems unprincipled
1228
- if (req.getKind () != RequirementKind::SameType &&
1229
- req.getKind () != RequirementKind::Conformance)
1228
+ if (req.getSecondType ()->isAny ()) {
1229
+ continue ;
1230
+ }
1231
+ if (!req.getFirstType ()->hasDependentMember ())
1230
1232
continue ;
1231
1233
1232
1234
if (auto dependentMemberType =
1233
- req.getFirstType ()->getAs <DependentMemberType>()) {
1235
+ req.getFirstType ()->castTo <DependentMemberType>()) {
1234
1236
if (dependentMemberType->getAssocType () == daSerializationReqAssocType) {
1235
- auto layout = req.getSecondType ()->getExistentialLayout ();
1237
+ auto requirementProto = req.getSecondType ();
1238
+ if (auto proto = dyn_cast_or_null<ProtocolDecl>(
1239
+ requirementProto->getAnyNominal ())) {
1240
+ into.insert (proto);
1241
+ } else {
1242
+ auto serialReqType = requirementProto->castTo <ExistentialType>()
1243
+ ->getConstraintType ();
1244
+ auto flattenedRequirements =
1245
+ flattenDistributedSerializationTypeToRequiredProtocols (
1246
+ serialReqType.getPointer ());
1236
1247
for (auto p : layout.getProtocols ()) {
1237
1248
serializationReqs.insert (p);
1238
1249
}
0 commit comments