File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 20
20
#include " swift/AST/GenericSignature.h"
21
21
#include " swift/AST/ProtocolConformanceRef.h"
22
22
#include " swift/AST/Type.h"
23
+ #include " swift/AST/TypeExpansionContext.h"
23
24
#include " swift/Basic/Debug.h"
24
25
#include " llvm/ADT/ArrayRef.h"
25
26
#include " llvm/ADT/DenseMapInfo.h"
@@ -176,7 +177,13 @@ class SubstitutionMap {
176
177
SubstitutionMap subst (TypeSubstitutionFn subs,
177
178
LookupConformanceFn conformances,
178
179
SubstOptions options=None) const ;
179
-
180
+
181
+ // / Apply type expansion lowering to all types in the substitution map. Opaque
182
+ // / archetypes will be lowered to their underlying types if the type expansion
183
+ // / context allows.
184
+ SubstitutionMap mapIntoTypeExpansionContext (
185
+ TypeExpansionContext context) const ;
186
+
180
187
// / Create a substitution map for a protocol conformance.
181
188
static SubstitutionMap
182
189
getProtocolSubstitutions (ProtocolDecl *protocol,
Original file line number Diff line number Diff line change @@ -715,3 +715,11 @@ bool SubstitutionMap::isIdentity() const {
715
715
716
716
return !hasNonIdentityReplacement;
717
717
}
718
+
719
+ SubstitutionMap SubstitutionMap::mapIntoTypeExpansionContext (
720
+ TypeExpansionContext context) const {
721
+ ReplaceOpaqueTypesWithUnderlyingTypes replacer (
722
+ context.getContext (), context.getResilienceExpansion (),
723
+ context.isWholeModuleContext ());
724
+ return this ->subst (replacer, replacer, SubstFlags::SubstituteOpaqueArchetypes);
725
+ }
You can’t perform that action at this time.
0 commit comments