@@ -4695,8 +4695,11 @@ class ArchetypeType : public SubstitutableType,
46954695 // / Register a nested type with the given name.
46964696 void registerNestedType (Identifier name, Type nested);
46974697
4698- // / getPrimary - Return the primary archetype parent of this archetype.
4699- PrimaryArchetypeType *getPrimary () const ;
4698+ // / Return the root archetype parent of this archetype.
4699+ ArchetypeType *getRoot () const ;
4700+
4701+ // / Get the generic environment this archetype lives in.
4702+ GenericEnvironment *getGenericEnvironment () const ;
47004703
47014704 // Implement isa/cast/dyncast/etc.
47024705 static bool classof (const TypeBase *T) {
@@ -4760,7 +4763,8 @@ class OpenedArchetypeType final : public ArchetypeType,
47604763{
47614764 friend TrailingObjects;
47624765 friend ArchetypeType;
4763-
4766+
4767+ mutable GenericEnvironment *Environment = nullptr ;
47644768 TypeBase *Opened;
47654769 UUID ID;
47664770public:
@@ -4789,12 +4793,17 @@ class OpenedArchetypeType final : public ArchetypeType,
47894793 return Opened;
47904794 }
47914795
4796+ // / Get a generic environment with this opened type bound to its generic
4797+ // / parameter.
4798+ GenericEnvironment *getGenericEnvironment () const ;
4799+
47924800 static bool classof (const TypeBase *T) {
47934801 return T->getKind () == TypeKind::OpenedArchetype;
47944802 }
47954803
47964804private:
4797- OpenedArchetypeType (const ASTContext &Ctx, Type Existential,
4805+ OpenedArchetypeType (const ASTContext &Ctx,
4806+ Type Existential,
47984807 ArrayRef<ProtocolDecl *> ConformsTo, Type Superclass,
47994808 LayoutConstraint Layout, UUID uuid);
48004809};
@@ -4831,6 +4840,10 @@ class NestedArchetypeType final : public ArchetypeType,
48314840 static bool classof (const TypeBase *T) {
48324841 return T->getKind () == TypeKind::NestedArchetype;
48334842 }
4843+
4844+ DependentMemberType *getInterfaceType () const {
4845+ return cast<DependentMemberType>(InterfaceType.getPointer ());
4846+ }
48344847
48354848private:
48364849 NestedArchetypeType (const ASTContext &Ctx,
0 commit comments