Skip to content

Commit 1646085

Browse files
committed
AST: Replace SubstitutionMap::hasOpenedExistential() with SubstitutionMap::hasLocalArchetypes() and actually use it
1 parent 83ccdbb commit 1646085

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

include/swift/AST/SubstitutionMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class SubstitutionMap {
168168

169169
/// Query whether any replacement types in the map contain an opened
170170
/// existential.
171-
bool hasOpenedExistential() const;
171+
bool hasLocalArchetypes() const;
172172

173173
/// Query whether any replacement types in the map contain dynamic Self.
174174
bool hasDynamicSelf() const;

include/swift/SIL/SILCloner.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,12 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
192192
// If we have local archetypes to substitute, check whether that's
193193
// relevant to this particular substitution.
194194
if (!LocalArchetypeSubs.empty()) {
195-
for (auto ty : Subs.getReplacementTypes()) {
195+
if (Subs.hasLocalArchetypes()) {
196196
// If we found a type containing a local archetype, substitute
197197
// open existentials throughout the substitution map.
198-
if (ty->hasLocalArchetype()) {
199-
Subs = Subs.subst(QueryTypeSubstitutionMapOrIdentity{
200-
LocalArchetypeSubs},
201-
MakeAbstractConformanceForGenericType());
202-
break;
203-
}
198+
Subs = Subs.subst(QueryTypeSubstitutionMapOrIdentity{
199+
LocalArchetypeSubs},
200+
MakeAbstractConformanceForGenericType());
204201
}
205202
}
206203

lib/AST/SubstitutionMap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ bool SubstitutionMap::hasArchetypes() const {
132132
return false;
133133
}
134134

135-
bool SubstitutionMap::hasOpenedExistential() const {
135+
bool SubstitutionMap::hasLocalArchetypes() const {
136136
for (Type replacementTy : getReplacementTypesBuffer()) {
137-
if (replacementTy && replacementTy->hasOpenedExistential())
137+
if (replacementTy && replacementTy->hasLocalArchetype())
138138
return true;
139139
}
140140
return false;

0 commit comments

Comments
 (0)