Skip to content

Commit 3c5298f

Browse files
committed
IRGen: Remove pointless usage of ArchetypeType::getRoot()
1 parent 25f998a commit 3c5298f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,11 +1764,7 @@ void WitnessTableBuilderBase::defineAssociatedTypeWitnessTableAccessFunction(
17641764
CanType associatedType,
17651765
ProtocolConformanceRef associatedConformance) {
17661766
bool hasArchetype = associatedType->hasArchetype();
1767-
OpaqueTypeArchetypeType *associatedRootOpaqueType = nullptr;
1768-
if (auto assocArchetype = dyn_cast<ArchetypeType>(associatedType)) {
1769-
associatedRootOpaqueType = dyn_cast<OpaqueTypeArchetypeType>(
1770-
assocArchetype->getRoot());
1771-
}
1767+
bool isOpaqueArchetype = isa<OpaqueTypeArchetypeType>(associatedType);
17721768

17731769
assert(isa<NormalProtocolConformance>(Conformance) && "has associated type");
17741770

@@ -1827,7 +1823,7 @@ void WitnessTableBuilderBase::defineAssociatedTypeWitnessTableAccessFunction(
18271823
}
18281824

18291825
// If there are no archetypes, return a reference to the table.
1830-
if (!hasArchetype && !associatedRootOpaqueType) {
1826+
if (!hasArchetype && !isOpaqueArchetype) {
18311827
auto wtable = conformanceI->getTable(IGF, &associatedTypeMetadata);
18321828
IGF.Builder.CreateRet(wtable);
18331829
return;

0 commit comments

Comments
 (0)