Skip to content

Commit 47b4493

Browse files
authored
Merge pull request swiftlang#79917 from eeckstein/rename-opened-archetype-type
AST: rename OpenArchetypeType -> ExistentialArchetypeType
2 parents c7922b2 + d225c47 commit 47b4493

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+153
-150
lines changed

docs/Generics/chapters/types.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ \section{Source Code Reference}\label{typesourceref}
759759
\item \texttt{ArchetypeType}, and its three subclasses:
760760
\begin{itemize}
761761
\item \texttt{PrimaryArchetypeType},
762-
\item \texttt{OpenedArchetypeType},
762+
\item \texttt{ExistentialArchetypeType},
763763
\item \texttt{OpaqueArchetypeType}.
764764
\end{itemize}
765765
\item The abstract types:

include/swift/AST/ASTBridgingImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ bool BridgedASTType::hasLocalArchetype() const {
403403
}
404404

405405
bool BridgedASTType::isExistentialArchetype() const {
406-
return unbridged()->is<swift::OpenedArchetypeType>();
406+
return unbridged()->is<swift::ExistentialArchetypeType>();
407407
}
408408

409409
bool BridgedASTType::isExistentialArchetypeWithError() const {

include/swift/AST/Expr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace swift {
5151
class ValueDecl;
5252
class Decl;
5353
class DeclRefExpr;
54-
class OpenedArchetypeType;
54+
class ExistentialArchetypeType;
5555
class ParamDecl;
5656
class Pattern;
5757
class SubscriptDecl;
@@ -3013,7 +3013,7 @@ class OpenExistentialExpr : public Expr {
30133013

30143014
/// Retrieve the opened archetype, which can only be referenced
30153015
/// within this expression's subexpression.
3016-
OpenedArchetypeType *getOpenedArchetype() const;
3016+
ExistentialArchetypeType *getOpenedArchetype() const;
30173017

30183018
static bool classof(const Expr *E) {
30193019
return E->getKind() == ExprKind::OpenExistential;

include/swift/AST/GenericEnvironment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ASTContext;
3636
class GenericTypeParamType;
3737
class OpaqueTypeDecl;
3838
class ElementArchetypeType;
39-
class OpenedArchetypeType;
39+
class ExistentialArchetypeType;
4040
class PackArchetypeType;
4141
class PackExpansionType;
4242
class SILModule;

include/swift/AST/TypeMatcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class TypeMatcher {
310310
}
311311
}
312312

313-
// FIXME: Once OpenedArchetypeType stores substitutions, do something
313+
// FIXME: Once ExistentialArchetypeType stores substitutions, do something
314314
// similar to the above.
315315

316316
if (firstArchetype->isEqual(secondType))

include/swift/AST/TypeNodes.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ ABSTRACT_TYPE(Substitutable, Type)
179179
ALWAYS_CANONICAL_TYPE(PrimaryArchetype, ArchetypeType)
180180
ALWAYS_CANONICAL_TYPE(OpaqueTypeArchetype, ArchetypeType)
181181
ABSTRACT_TYPE(LocalArchetype, ArchetypeType)
182-
ALWAYS_CANONICAL_TYPE(OpenedArchetype, LocalArchetypeType)
182+
ALWAYS_CANONICAL_TYPE(ExistentialArchetype, LocalArchetypeType)
183183
ALWAYS_CANONICAL_TYPE(ElementArchetype, LocalArchetypeType)
184-
TYPE_RANGE(LocalArchetype, OpenedArchetype, ElementArchetype)
184+
TYPE_RANGE(LocalArchetype, ExistentialArchetype, ElementArchetype)
185185
ALWAYS_CANONICAL_TYPE(PackArchetype, ArchetypeType)
186186
TYPE_RANGE(Archetype, PrimaryArchetype, PackArchetype)
187187
TYPE(GenericTypeParam, SubstitutableType)

include/swift/AST/TypeTransform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ case TypeKind::Id:
165165
newSubMap);
166166
}
167167

168-
case TypeKind::OpenedArchetype: {
168+
case TypeKind::ExistentialArchetype: {
169169
auto *local = cast<LocalArchetypeType>(base);
170170
if (auto result = asDerived().transformLocalArchetypeType(local, pos))
171171
return *result;

include/swift/AST/Types.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class GenericSignatureBuilder;
7575
class Identifier;
7676
class InOutType;
7777
class OpaqueTypeDecl;
78-
class OpenedArchetypeType;
78+
class ExistentialArchetypeType;
7979
class PackExpansionType;
8080
class PackType;
8181
enum class ParamSpecifier : uint8_t;
@@ -114,6 +114,9 @@ enum class TypeKind : uint8_t {
114114
#define TYPE_RANGE(Id, FirstId, LastId) \
115115
First_##Id##Type = FirstId, Last_##Id##Type = LastId,
116116
#include "swift/AST/TypeNodes.def"
117+
// For backward compatibility in LLDB sources.
118+
// TODO: remove this once OpenedArchetype is renamed in LLDB sources.
119+
OpenedArchetype = ExistentialArchetype
117120
};
118121

119122
enum : unsigned {
@@ -6971,16 +6974,16 @@ class LocalArchetypeType : public ArchetypeType {
69716974

69726975
public:
69736976
static bool classof(const TypeBase *type) {
6974-
return type->getKind() == TypeKind::OpenedArchetype ||
6977+
return type->getKind() == TypeKind::ExistentialArchetype ||
69756978
type->getKind() == TypeKind::ElementArchetype;
69766979
}
69776980
};
69786981
BEGIN_CAN_TYPE_WRAPPER(LocalArchetypeType, ArchetypeType)
69796982
END_CAN_TYPE_WRAPPER(LocalArchetypeType, ArchetypeType)
69806983

69816984
/// An archetype that represents the dynamic type of an opened existential.
6982-
class OpenedArchetypeType final : public LocalArchetypeType,
6983-
private ArchetypeTrailingObjects<OpenedArchetypeType>
6985+
class ExistentialArchetypeType final : public LocalArchetypeType,
6986+
private ArchetypeTrailingObjects<ExistentialArchetypeType>
69846987
{
69856988
friend TrailingObjects;
69866989
friend ArchetypeType;
@@ -6991,7 +6994,7 @@ class OpenedArchetypeType final : public LocalArchetypeType,
69916994
///
69926995
/// This is only invoked by the generic environment when mapping the
69936996
/// interface type into context.
6994-
static CanTypeWrapper<OpenedArchetypeType>
6997+
static CanTypeWrapper<ExistentialArchetypeType>
69956998
getNew(GenericEnvironment *environment, Type interfaceType,
69966999
ArrayRef<ProtocolDecl *> conformsTo, Type superclass,
69977000
LayoutConstraint layout);
@@ -7001,7 +7004,7 @@ class OpenedArchetypeType final : public LocalArchetypeType,
70017004
/// of an existential value.
70027005
///
70037006
/// \param existential The existential type to open.
7004-
static CanTypeWrapper<OpenedArchetypeType> get(CanType existential);
7007+
static CanTypeWrapper<ExistentialArchetypeType> get(CanType existential);
70057008

70067009
/// Create a new archetype that represents the opened type
70077010
/// of an existential value.
@@ -7014,18 +7017,18 @@ class OpenedArchetypeType final : public LocalArchetypeType,
70147017
static Type getAny(Type existential);
70157018

70167019
static bool classof(const TypeBase *T) {
7017-
return T->getKind() == TypeKind::OpenedArchetype;
7020+
return T->getKind() == TypeKind::ExistentialArchetype;
70187021
}
70197022

70207023
private:
7021-
OpenedArchetypeType(GenericEnvironment *environment, Type interfaceType,
7024+
ExistentialArchetypeType(GenericEnvironment *environment, Type interfaceType,
70227025
ArrayRef<ProtocolDecl *> conformsTo,
70237026
Type superclass,
70247027
LayoutConstraint layout,
70257028
RecursiveTypeProperties properties);
70267029
};
7027-
BEGIN_CAN_TYPE_WRAPPER(OpenedArchetypeType, LocalArchetypeType)
7028-
END_CAN_TYPE_WRAPPER(OpenedArchetypeType, LocalArchetypeType)
7030+
BEGIN_CAN_TYPE_WRAPPER(ExistentialArchetypeType, LocalArchetypeType)
7031+
END_CAN_TYPE_WRAPPER(ExistentialArchetypeType, LocalArchetypeType)
70297032

70307033
/// A wrapper around a shape type to use in ArchetypeTrailingObjects
70317034
/// for PackArchetypeType.
@@ -7111,7 +7114,7 @@ const Type *ArchetypeType::getSubclassTrailingObjects() const {
71117114
if (auto opaqueTy = dyn_cast<OpaqueTypeArchetypeType>(this)) {
71127115
return opaqueTy->getTrailingObjects<Type>();
71137116
}
7114-
if (auto openedTy = dyn_cast<OpenedArchetypeType>(this)) {
7117+
if (auto openedTy = dyn_cast<ExistentialArchetypeType>(this)) {
71157118
return openedTy->getTrailingObjects<Type>();
71167119
}
71177120
if (auto childTy = dyn_cast<PackArchetypeType>(this)) {

include/swift/SIL/SILCloner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
383383
return numScalarElements == 1;
384384
}
385385

386-
void remapRootOpenedType(CanOpenedArchetypeType archetypeTy) {
386+
void remapRootOpenedType(CanExistentialArchetypeType archetypeTy) {
387387
auto *origEnv = archetypeTy->getGenericEnvironment();
388388

389389
auto genericSig = origEnv->getGenericSignature();

include/swift/SIL/SILInstruction.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7773,7 +7773,7 @@ class OpenExistentialAddrInst
77737773

77747774
OpenedExistentialAccess getAccessKind() const { return ForAccess; }
77757775

7776-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7776+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
77777777
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
77787778
assert(archetype && archetype->isRoot() &&
77797779
"Type should be a root opened archetype");
@@ -7794,7 +7794,7 @@ class OpenExistentialValueInst
77947794
ValueOwnershipKind forwardingOwnershipKind);
77957795

77967796
public:
7797-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7797+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
77987798
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
77997799
assert(archetype && archetype->isRoot() &&
78007800
"Type should be a root opened archetype");
@@ -7815,7 +7815,7 @@ class OpenExistentialRefInst
78157815
ValueOwnershipKind forwardingOwnershipKind);
78167816

78177817
public:
7818-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7818+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
78197819
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
78207820
assert(archetype && archetype->isRoot() &&
78217821
"Type should be a root opened archetype");
@@ -7837,7 +7837,7 @@ class OpenExistentialMetatypeInst
78377837
SILType ty);
78387838

78397839
public:
7840-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7840+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
78417841
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
78427842
assert(archetype && archetype->isRoot() &&
78437843
"Type should be a root opened archetype");
@@ -7858,7 +7858,7 @@ class OpenExistentialBoxInst
78587858
SILType ty);
78597859

78607860
public:
7861-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7861+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
78627862
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
78637863
assert(archetype && archetype->isRoot() &&
78647864
"Type should be a root opened archetype");
@@ -7879,7 +7879,7 @@ class OpenExistentialBoxValueInst
78797879
ValueOwnershipKind forwardingOwnershipKind);
78807880

78817881
public:
7882-
CanOpenedArchetypeType getDefinedOpenedArchetype() const {
7882+
CanExistentialArchetypeType getDefinedOpenedArchetype() const {
78837883
const auto archetype = getOpenedArchetypeOf(getType().getASTType());
78847884
assert(archetype && archetype->isRoot() &&
78857885
"Type should be a root opened archetype");

0 commit comments

Comments
 (0)