@@ -5032,9 +5032,15 @@ Type substOpaqueTypesWithUnderlyingTypes(Type type,
5032
5032
5033
5033
CanType substOpaqueTypesWithUnderlyingTypes (CanType type,
5034
5034
TypeExpansionContext context);
5035
+
5035
5036
ProtocolConformanceRef
5036
5037
substOpaqueTypesWithUnderlyingTypes (ProtocolConformanceRef ref,
5037
5038
TypeExpansionContext context);
5039
+
5040
+ SubstitutionMap
5041
+ substOpaqueTypesWithUnderlyingTypes (SubstitutionMap subs,
5042
+ TypeExpansionContext context);
5043
+
5038
5044
namespace Lowering {
5039
5045
class TypeConverter ;
5040
5046
}
@@ -7082,6 +7088,32 @@ class ReplaceOpaqueTypesWithUnderlyingTypes {
7082
7088
bool isWholeModule () const { return inContextAndIsWholeModule.getInt (); }
7083
7089
};
7084
7090
7091
+ // / A function object that can be used as a \c TypeSubstitutionFn and
7092
+ // / \c LookupConformanceFn for \c Type::subst style APIs to map existential
7093
+ // / archetypes in the given generic environment to known concrete types from
7094
+ // / the given substitution map.
7095
+ class ReplaceExistentialArchetypesWithConcreteTypes {
7096
+ private:
7097
+ GenericEnvironment *env;
7098
+ SubstitutionMap subs;
7099
+
7100
+ Type getInterfaceType (ExistentialArchetypeType *type) const ;
7101
+
7102
+ public:
7103
+ ReplaceExistentialArchetypesWithConcreteTypes (GenericEnvironment *env,
7104
+ SubstitutionMap subs)
7105
+ : env(env), subs(subs) {}
7106
+
7107
+ // / TypeSubstitutionFn
7108
+ Type operator ()(SubstitutableType *type) const ;
7109
+
7110
+ // / LookupConformanceFn
7111
+ ProtocolConformanceRef operator ()(CanType origType,
7112
+ Type substType,
7113
+ ProtocolDecl *protocol) const ;
7114
+
7115
+ };
7116
+
7085
7117
// / An archetype that's only valid in a portion of a local context.
7086
7118
class LocalArchetypeType : public ArchetypeType {
7087
7119
protected:
0 commit comments