Skip to content

Commit 0616333

Browse files
committed
AST: Remove origType parameter from ProtocolConformanceRef::getAssociatedType()
1 parent a209ff8 commit 0616333

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

include/swift/AST/ProtocolConformanceRef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class ProtocolConformanceRef {
209209

210210
/// Given a dependent type (expressed in terms of this conformance's
211211
/// protocol), follow it from the conforming type.
212-
Type getAssociatedType(Type origType, Type dependentType) const;
212+
Type getAssociatedType(Type dependentType) const;
213213

214214
/// Given a dependent type (expressed in terms of this conformance's
215215
/// protocol) and conformance, follow it from the conforming type.

lib/AST/PackConformance.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,15 @@ PackConformance *PackConformance::getAssociatedConformance(
142142
auto packElement = ConformingType->getElementType(i);
143143

144144
if (auto *packExpansion = packElement->getAs<PackExpansionType>()) {
145-
auto assocTypePattern =
146-
conformances[i].getAssociatedType(packExpansion->getPatternType(),
147-
assocType);
145+
auto assocTypePattern = conformances[i].getAssociatedType(assocType);
148146
packElements.push_back(PackExpansionType::get(
149147
assocTypePattern, packExpansion->getCountType()));
150148

151149
auto assocConformancePattern =
152150
conformances[i].getAssociatedConformance(assocType, protocol);
153151
packConformances.push_back(assocConformancePattern);
154152
} else {
155-
auto assocTypeScalar =
156-
conformances[i].getAssociatedType(packElement, assocType);
153+
auto assocTypeScalar = conformances[i].getAssociatedType(assocType);
157154
packElements.push_back(assocTypeScalar);
158155

159156
auto assocConformanceScalar =

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ Type ProtocolConformance::getAssociatedType(Type assocType) const {
628628
"associated type must be a type parameter");
629629

630630
ProtocolConformanceRef ref(const_cast<ProtocolConformance*>(this));
631-
return ref.getAssociatedType(getType(), assocType);
631+
return ref.getAssociatedType(assocType);
632632
}
633633

634634
ProtocolConformanceRef

lib/AST/ProtocolConformanceRef.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,12 @@ Type ProtocolConformanceRef::getTypeWitness(AssociatedTypeDecl *assocType,
210210
return DependentMemberType::get(conformingType, assocType);
211211
}
212212

213-
Type ProtocolConformanceRef::getAssociatedType(Type conformingType,
214-
Type assocType) const {
213+
Type ProtocolConformanceRef::getAssociatedType(Type assocType) const {
215214
if (isInvalid())
216215
return ErrorType::get(assocType->getASTContext());
217216

218-
auto proto = getProtocol();
219-
220217
auto substMap =
221-
SubstitutionMap::getProtocolSubstitutions(proto, conformingType, *this);
218+
SubstitutionMap::getProtocolSubstitutions(getProtocol(), getType(), *this);
222219
return assocType.subst(substMap);
223220
}
224221

lib/IRGen/GenProto.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,8 +3448,7 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
34483448
auto association = entry.getAssociatedConformancePath();
34493449
auto associatedRequirement = entry.getAssociatedConformanceRequirement();
34503450

3451-
CanType associatedType =
3452-
sourceConformance.getAssociatedType(sourceType, association)
3451+
CanType associatedType = sourceConformance.getAssociatedType(association)
34533452
->getCanonicalType();
34543453
sourceKey.Type = associatedType;
34553454

@@ -3527,7 +3526,7 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
35273526
// type directly.
35283527
auto depMemType = cast<DependentMemberType>(association);
35293528
CanType baseSubstType =
3530-
sourceConformance.getAssociatedType(sourceType, depMemType.getBase())
3529+
sourceConformance.getAssociatedType(depMemType.getBase())
35313530
->getCanonicalType();
35323531
if (auto archetypeType = dyn_cast<ArchetypeType>(baseSubstType)) {
35333532
AssociatedType baseAssocType(depMemType->getAssocType());

0 commit comments

Comments
 (0)