@@ -130,22 +130,18 @@ static void desugarConformanceRequirement(Type subjectType, Type constraintType,
130130 return ;
131131 }
132132
133- auto layout = constraintType->getExistentialLayout ();
134-
135- if (auto layoutConstraint = layout.getLayoutConstraint ())
136- desugarLayoutRequirement (subjectType, layoutConstraint, result);
137-
138- if (auto superclass = layout.explicitSuperclass )
139- desugarSuperclassRequirement (subjectType, superclass, result);
140-
141- for (auto *proto : layout.getProtocols ()) {
142- if (!subjectType->isTypeParameter ()) {
143- // FIXME: Check conformance, diagnose redundancy or conflict upstream
144- return ;
145- }
133+ auto *compositionType = constraintType->castTo <ProtocolCompositionType>();
134+ if (compositionType->hasExplicitAnyObject ()) {
135+ desugarLayoutRequirement (subjectType,
136+ LayoutConstraint::getLayoutConstraint (
137+ LayoutConstraintKind::Class), result);
138+ }
146139
147- result.emplace_back (RequirementKind::Conformance, subjectType,
148- proto);
140+ for (auto memberType : compositionType->getMembers ()) {
141+ if (memberType->isExistentialType ())
142+ desugarConformanceRequirement (subjectType, memberType, result);
143+ else
144+ desugarSuperclassRequirement (subjectType, memberType, result);
149145 }
150146}
151147
0 commit comments