Skip to content

Commit 77f9486

Browse files
committed
AST: Add SubstitutionMap::hasOpaqueArchetypes()
1 parent 1cdb654 commit 77f9486

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/swift/AST/SubstitutionMap.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,13 @@ class SubstitutionMap {
170170
bool hasArchetypes() const;
171171

172172
/// Query whether any replacement types in the map contain an opened
173-
/// existential.
173+
/// existential or opened element.
174174
bool hasLocalArchetypes() const;
175175

176+
/// Query whether any replacement types in the map contain an opaque
177+
/// return type.
178+
bool hasOpaqueArchetypes() const;
179+
176180
/// Query whether any replacement types in the map contain dynamic Self.
177181
bool hasDynamicSelf() const;
178182

lib/AST/SubstitutionMap.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ bool SubstitutionMap::hasLocalArchetypes() const {
140140
return false;
141141
}
142142

143+
bool SubstitutionMap::hasOpaqueArchetypes() const {
144+
for (Type replacementTy : getReplacementTypesBuffer()) {
145+
if (replacementTy && replacementTy->hasOpaqueArchetype())
146+
return true;
147+
}
148+
return false;
149+
}
150+
143151
bool SubstitutionMap::hasDynamicSelf() const {
144152
for (Type replacementTy : getReplacementTypesBuffer()) {
145153
if (replacementTy && replacementTy->hasDynamicSelfType())

0 commit comments

Comments
 (0)