@@ -2828,6 +2828,7 @@ static void concretizeNestedTypeFromConcreteParent(
28282828 assert (parentEquiv->conformsTo .count (proto) > 0 &&
28292829 " No conformance requirement" );
28302830 const RequirementSource *parentConcreteSource = nullptr ;
2831+
28312832 for (const auto &constraint : parentEquiv->conformsTo .find (proto)->second ) {
28322833 if (!isSuperclassConstrained) {
28332834 if (constraint.source ->kind == RequirementSource::Concrete) {
@@ -5796,16 +5797,24 @@ static void expandSameTypeConstraints(GenericSignatureBuilder &builder,
57965797 bool alreadyFound = false ;
57975798 const RequirementSource *conformsSource = nullptr ;
57985799 for (const auto &constraint : conforms.second ) {
5799- if (constraint.source ->getAffectedType ()->isEqual (dependentType)) {
5800+ bool derivedViaConcrete = false ;
5801+
5802+ auto *minimal = constraint.source ->getMinimalConformanceSource (
5803+ builder, constraint.getSubjectDependentType ({ }), proto,
5804+ derivedViaConcrete);
5805+
5806+ if (minimal == nullptr || derivedViaConcrete)
5807+ continue ;
5808+
5809+ if (minimal->getAffectedType ()->isEqual (dependentType)) {
58005810 alreadyFound = true ;
58015811 break ;
58025812 }
58035813
58045814 // Capture the source for later use, skipping
58055815 if (!conformsSource &&
5806- constraint.source ->kind
5807- != RequirementSource::RequirementSignatureSelf)
5808- conformsSource = constraint.source ;
5816+ minimal->kind != RequirementSource::RequirementSignatureSelf)
5817+ conformsSource = minimal;
58095818 }
58105819
58115820 if (alreadyFound) continue ;
@@ -6382,9 +6391,7 @@ GenericSignatureBuilder::finalize(TypeArrayView<GenericTypeParamType> genericPar
63826391 equivClass.recursiveSuperclassType = true ;
63836392 }
63846393 }
6385-
6386- checkConformanceConstraints (genericParams, &equivClass);
6387- };
6394+ }
63886395
63896396 if (!Impl->ExplicitSameTypeRequirements .empty ()) {
63906397 // FIXME: Expand all conformance requirements. This is expensive :(
@@ -6855,18 +6862,6 @@ static bool isRedundantlyInheritableObjCProtocol(
68556862 return true ;
68566863}
68576864
6858- void GenericSignatureBuilder::checkConformanceConstraints (
6859- TypeArrayView<GenericTypeParamType> genericParams,
6860- EquivalenceClass *equivClass) {
6861- for (auto &entry : equivClass->conformsTo ) {
6862- // Remove self-derived constraints.
6863- assert (!entry.second .empty () && " No constraints to work with?" );
6864-
6865- // Remove any self-derived constraints.
6866- removeSelfDerived (*this , entry.second , entry.first );
6867- }
6868- }
6869-
68706865void GenericSignatureBuilder::diagnoseRedundantRequirements () const {
68716866 for (const auto &req : Impl->ExplicitRequirements ) {
68726867 auto *source = req.getSource ();
0 commit comments