@@ -2828,6 +2828,7 @@ static void concretizeNestedTypeFromConcreteParent(
2828
2828
assert (parentEquiv->conformsTo .count (proto) > 0 &&
2829
2829
" No conformance requirement" );
2830
2830
const RequirementSource *parentConcreteSource = nullptr ;
2831
+
2831
2832
for (const auto &constraint : parentEquiv->conformsTo .find (proto)->second ) {
2832
2833
if (!isSuperclassConstrained) {
2833
2834
if (constraint.source ->kind == RequirementSource::Concrete) {
@@ -5796,16 +5797,24 @@ static void expandSameTypeConstraints(GenericSignatureBuilder &builder,
5796
5797
bool alreadyFound = false ;
5797
5798
const RequirementSource *conformsSource = nullptr ;
5798
5799
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)) {
5800
5810
alreadyFound = true ;
5801
5811
break ;
5802
5812
}
5803
5813
5804
5814
// Capture the source for later use, skipping
5805
5815
if (!conformsSource &&
5806
- constraint.source ->kind
5807
- != RequirementSource::RequirementSignatureSelf)
5808
- conformsSource = constraint.source ;
5816
+ minimal->kind != RequirementSource::RequirementSignatureSelf)
5817
+ conformsSource = minimal;
5809
5818
}
5810
5819
5811
5820
if (alreadyFound) continue ;
@@ -6382,9 +6391,7 @@ GenericSignatureBuilder::finalize(TypeArrayView<GenericTypeParamType> genericPar
6382
6391
equivClass.recursiveSuperclassType = true ;
6383
6392
}
6384
6393
}
6385
-
6386
- checkConformanceConstraints (genericParams, &equivClass);
6387
- };
6394
+ }
6388
6395
6389
6396
if (!Impl->ExplicitSameTypeRequirements .empty ()) {
6390
6397
// FIXME: Expand all conformance requirements. This is expensive :(
@@ -6855,18 +6862,6 @@ static bool isRedundantlyInheritableObjCProtocol(
6855
6862
return true ;
6856
6863
}
6857
6864
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
-
6870
6865
void GenericSignatureBuilder::diagnoseRedundantRequirements () const {
6871
6866
for (const auto &req : Impl->ExplicitRequirements ) {
6872
6867
auto *source = req.getSource ();
0 commit comments