@@ -2106,7 +2106,8 @@ static void addConditionalRequirements(GenericSignatureBuilder &builder,
2106
2106
const RequirementSource *
2107
2107
GenericSignatureBuilder::resolveConcreteConformance (PotentialArchetype *pa,
2108
2108
ProtocolDecl *proto) {
2109
- auto concrete = pa->getConcreteType ();
2109
+ auto equivClass = pa->getEquivalenceClassIfPresent ();
2110
+ auto concrete = equivClass ? equivClass->concreteType : Type ();
2110
2111
if (!concrete) return nullptr ;
2111
2112
2112
2113
// Conformance to this protocol is redundant; update the requirement source
@@ -2149,7 +2150,8 @@ const RequirementSource *GenericSignatureBuilder::resolveSuperConformance(
2149
2150
PotentialArchetype *pa,
2150
2151
ProtocolDecl *proto) {
2151
2152
// Get the superclass constraint.
2152
- Type superclass = pa->getSuperclass ();
2153
+ auto equivClass = pa->getEquivalenceClassIfPresent ();
2154
+ Type superclass = equivClass ? equivClass->superclass : nullptr ;
2153
2155
if (!superclass) return nullptr ;
2154
2156
2155
2157
// Lookup the conformance of the superclass to this protocol.
@@ -2710,7 +2712,7 @@ PotentialArchetype *PotentialArchetype::updateNestedTypeForConformance(
2710
2712
type = type.subst (subMap, SubstFlags::UseErrorType);
2711
2713
} else {
2712
2714
// Substitute in the superclass type.
2713
- auto superclass = getSuperclass () ;
2715
+ auto superclass = getEquivalenceClassIfPresent ()-> superclass ;
2714
2716
auto superclassDecl = superclass->getClassOrBoundGenericClass ();
2715
2717
type = superclass->getTypeOfMember (
2716
2718
superclassDecl->getParentModule (), concreteDecl,
@@ -3580,7 +3582,8 @@ void GenericSignatureBuilder::updateSuperclass(
3580
3582
// Local function to handle the update of superclass conformances
3581
3583
// when the superclass constraint changes.
3582
3584
auto updateSuperclassConformances = [&] {
3583
- for (auto proto : T->getConformsTo ()) {
3585
+ for (const auto &conforms : equivClass->conformsTo ) {
3586
+ auto proto = conforms.first ;
3584
3587
if (auto superSource = resolveSuperConformance (T, proto)) {
3585
3588
for (auto assocType : proto->getAssociatedTypeMembers ()) {
3586
3589
@@ -4029,8 +4032,8 @@ ConstraintResult GenericSignatureBuilder::addSameTypeRequirementToConcrete(
4029
4032
4030
4033
// Make sure the concrete type fulfills the conformance requirements of
4031
4034
// this equivalence class.
4032
- for (auto protocol : rep-> getConformsTo () ) {
4033
- if (!resolveConcreteConformance (rep, protocol ))
4035
+ for (const auto &conforms : equivClass-> conformsTo ) {
4036
+ if (!resolveConcreteConformance (rep, conforms. first ))
4034
4037
return ConstraintResult::Conflicting;
4035
4038
}
4036
4039
@@ -6185,7 +6188,7 @@ void GenericSignatureBuilder::enumerateRequirements(llvm::function_ref<
6185
6188
if (knownAnchor != equivClass->derivedSameTypeComponents .end ()) {
6186
6189
// If this equivalence class is bound to a concrete type, equate the
6187
6190
// anchor with a concrete type.
6188
- if (Type concreteType = rep-> getConcreteType () ) {
6191
+ if (Type concreteType = equivClass-> concreteType ) {
6189
6192
// If the parent of this anchor is also a concrete type, don't
6190
6193
// create a requirement.
6191
6194
if (!archetype->isGenericParam () &&
0 commit comments