@@ -5914,8 +5914,29 @@ class ReplaceOpaqueTypesWithUnderlyingTypes {
5914
5914
bool isWholeModule () const { return inContextAndIsWholeModule.getInt (); }
5915
5915
};
5916
5916
5917
+ // / An archetype that's only valid in a portion of a local context.
5918
+ class LocalArchetypeType : public ArchetypeType {
5919
+ protected:
5920
+ using ArchetypeType::ArchetypeType;
5921
+
5922
+ public:
5923
+ LocalArchetypeType *getRoot () const {
5924
+ return cast<LocalArchetypeType>(ArchetypeType::getRoot ());
5925
+ }
5926
+
5927
+ static bool classof (const TypeBase *type) {
5928
+ return type->getKind () == TypeKind::OpenedArchetype ||
5929
+ type->getKind () == TypeKind::ElementArchetype;
5930
+ }
5931
+ };
5932
+ BEGIN_CAN_TYPE_WRAPPER (LocalArchetypeType, ArchetypeType)
5933
+ CanLocalArchetypeType getRoot() const {
5934
+ return CanLocalArchetypeType (getPointer ()->getRoot ());
5935
+ }
5936
+ END_CAN_TYPE_WRAPPER (LocalArchetypeType, ArchetypeType)
5937
+
5917
5938
// / An archetype that represents the dynamic type of an opened existential.
5918
- class OpenedArchetypeType final : public ArchetypeType ,
5939
+ class OpenedArchetypeType final : public LocalArchetypeType ,
5919
5940
private ArchetypeTrailingObjects<OpenedArchetypeType>
5920
5941
{
5921
5942
friend TrailingObjects;
@@ -6016,11 +6037,11 @@ class OpenedArchetypeType final : public ArchetypeType,
6016
6037
ArrayRef<ProtocolDecl *> conformsTo, Type superclass,
6017
6038
LayoutConstraint layout);
6018
6039
};
6019
- BEGIN_CAN_TYPE_WRAPPER (OpenedArchetypeType, ArchetypeType )
6040
+ BEGIN_CAN_TYPE_WRAPPER (OpenedArchetypeType, LocalArchetypeType )
6020
6041
CanOpenedArchetypeType getRoot() const {
6021
6042
return CanOpenedArchetypeType (getPointer ()->getRoot ());
6022
6043
}
6023
- END_CAN_TYPE_WRAPPER (OpenedArchetypeType, ArchetypeType )
6044
+ END_CAN_TYPE_WRAPPER (OpenedArchetypeType, LocalArchetypeType )
6024
6045
6025
6046
// / A wrapper around a shape type to use in ArchetypeTrailingObjects
6026
6047
// / for PackArchetypeType.
@@ -6065,7 +6086,7 @@ BEGIN_CAN_TYPE_WRAPPER(PackArchetypeType, ArchetypeType)
6065
6086
END_CAN_TYPE_WRAPPER(PackArchetypeType, ArchetypeType)
6066
6087
6067
6088
// / An archetype that represents the element type of a pack archetype.
6068
- class ElementArchetypeType final : public ArchetypeType ,
6089
+ class ElementArchetypeType final : public LocalArchetypeType ,
6069
6090
private ArchetypeTrailingObjects<ElementArchetypeType>
6070
6091
{
6071
6092
friend TrailingObjects;
@@ -6104,11 +6125,11 @@ class ElementArchetypeType final : public ArchetypeType,
6104
6125
ArrayRef<ProtocolDecl *> conformsTo, Type superclass,
6105
6126
LayoutConstraint layout);
6106
6127
};
6107
- BEGIN_CAN_TYPE_WRAPPER (ElementArchetypeType, ArchetypeType )
6128
+ BEGIN_CAN_TYPE_WRAPPER (ElementArchetypeType, LocalArchetypeType )
6108
6129
CanElementArchetypeType getRoot() const {
6109
6130
return CanElementArchetypeType (getPointer ()->getRoot ());
6110
6131
}
6111
- END_CAN_TYPE_WRAPPER (ElementArchetypeType, ArchetypeType )
6132
+ END_CAN_TYPE_WRAPPER (ElementArchetypeType, LocalArchetypeType )
6112
6133
6113
6134
template<typename Type>
6114
6135
const Type *ArchetypeType::getSubclassTrailingObjects() const {
0 commit comments