@@ -5032,9 +5032,15 @@ Type substOpaqueTypesWithUnderlyingTypes(Type type,
50325032
50335033CanType substOpaqueTypesWithUnderlyingTypes (CanType type,
50345034 TypeExpansionContext context);
5035+
50355036ProtocolConformanceRef
50365037substOpaqueTypesWithUnderlyingTypes (ProtocolConformanceRef ref,
50375038 TypeExpansionContext context);
5039+
5040+ SubstitutionMap
5041+ substOpaqueTypesWithUnderlyingTypes (SubstitutionMap subs,
5042+ TypeExpansionContext context);
5043+
50385044namespace Lowering {
50395045 class TypeConverter ;
50405046}
@@ -7082,6 +7088,32 @@ class ReplaceOpaqueTypesWithUnderlyingTypes {
70827088 bool isWholeModule () const { return inContextAndIsWholeModule.getInt (); }
70837089};
70847090
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+
70857117// / An archetype that's only valid in a portion of a local context.
70867118class LocalArchetypeType : public ArchetypeType {
70877119protected:
0 commit comments