@@ -126,7 +126,7 @@ class RecursiveTypeProperties {
126
126
127
127
// / This type expression contains a context-dependent archetype, either a
128
128
// / \c PrimaryArchetypeType, \c OpenedArchetypeType, or
129
- // / \c SequenceArchetype .
129
+ // / \c PackArchetype .
130
130
HasArchetype = 0x02 ,
131
131
132
132
// / This type expression contains a GenericTypeParamType.
@@ -161,8 +161,8 @@ class RecursiveTypeProperties {
161
161
HasPlaceholder = 0x800 ,
162
162
163
163
// / This type contains a generic type parameter that is declared as a
164
- // / type sequence
165
- HasTypeSequence = 0x1000 ,
164
+ // / parameter pack.
165
+ HasParameterPack = 0x1000 ,
166
166
167
167
// / This type contains a parameterized existential type \c any P<T>.
168
168
HasParameterizedExistential = 0x2000 ,
@@ -225,7 +225,7 @@ class RecursiveTypeProperties {
225
225
// / Does a type with these properties structurally contain a placeholder?
226
226
bool hasPlaceholder () const { return Bits & HasPlaceholder; }
227
227
228
- bool hasTypeSequence () const { return Bits & HasTypeSequence ; }
228
+ bool hasParameterPack () const { return Bits & HasParameterPack ; }
229
229
230
230
// / Does a type with these properties structurally contain a
231
231
// / parameterized existential type?
@@ -624,8 +624,8 @@ class alignas(1 << TypeAlignInBits) TypeBase
624
624
return getRecursiveProperties ().hasOpenedExistential ();
625
625
}
626
626
627
- bool hasTypeSequence () const {
628
- return getRecursiveProperties ().hasTypeSequence ();
627
+ bool hasParameterPack () const {
628
+ return getRecursiveProperties ().hasParameterPack ();
629
629
}
630
630
631
631
// / Determine whether the type involves a parameterized existential type.
@@ -655,10 +655,9 @@ class alignas(1 << TypeAlignInBits) TypeBase
655
655
void getRootOpenedExistentials (
656
656
SmallVectorImpl<OpenedArchetypeType *> &rootOpenedArchetypes) const ;
657
657
658
- // / Retrieve the set of type sequence generic parameters that occur
659
- // / within this type.
660
- void getTypeSequenceParameters (
661
- SmallVectorImpl<Type> &rootTypeSequenceParams) const ;
658
+ // / Retrieve the set of type parameter packs that occur within this type.
659
+ void getTypeParameterPacks (
660
+ SmallVectorImpl<Type> &rootParameterPacks) const ;
662
661
663
662
// / Replace opened archetypes with the given root with their most
664
663
// / specific non-dependent upper bounds throughout this type.
@@ -689,12 +688,12 @@ class alignas(1 << TypeAlignInBits) TypeBase
689
688
// / whether a type parameter exists at any position.
690
689
bool isTypeParameter ();
691
690
692
- // / Determine whether this type is a type sequence parameter, which is
691
+ // / Determine whether this type is a type parameter pack , which is
693
692
// / either a GenericTypeParamType or a DependentMemberType.
694
693
// /
695
694
// / Like \c isTypeParameter, this routine will return \c false for types that
696
695
// / include type parameters in nested positions e.g. \c X<T...>.
697
- bool isTypeSequenceParameter ();
696
+ bool isParameterPack ();
698
697
699
698
// / Determine whether this type can dynamically be an optional type.
700
699
// /
@@ -6002,15 +6001,11 @@ BEGIN_CAN_TYPE_WRAPPER(OpenedArchetypeType, ArchetypeType)
6002
6001
}
6003
6002
END_CAN_TYPE_WRAPPER (OpenedArchetypeType, ArchetypeType)
6004
6003
6005
- // / An archetype that represents an opaque element of a type sequence in context.
6006
- // /
6007
- // / \code
6008
- // / struct Foo<@_typeSequence Ts> { var xs: @_typeSequence Ts }
6009
- // / func foo<@_typeSequence T>(_ xs: T...) where T: P { }
6010
- // / \endcode
6011
- class SequenceArchetypeType final
6004
+ // / An archetype that represents an opaque element of a type
6005
+ // / parameter pack in context.
6006
+ class PackArchetypeType final
6012
6007
: public ArchetypeType,
6013
- private ArchetypeTrailingObjects<SequenceArchetypeType > {
6008
+ private ArchetypeTrailingObjects<PackArchetypeType > {
6014
6009
friend TrailingObjects;
6015
6010
friend ArchetypeType;
6016
6011
@@ -6019,23 +6014,23 @@ class SequenceArchetypeType final
6019
6014
// /
6020
6015
// / The ConformsTo array will be minimized then copied into the ASTContext
6021
6016
// / by this routine.
6022
- static CanTypeWrapper<SequenceArchetypeType >
6017
+ static CanTypeWrapper<PackArchetypeType >
6023
6018
get (const ASTContext &Ctx, GenericEnvironment *GenericEnv,
6024
6019
Type InterfaceType,
6025
6020
SmallVectorImpl<ProtocolDecl *> &ConformsTo, Type Superclass,
6026
6021
LayoutConstraint Layout);
6027
6022
6028
6023
static bool classof (const TypeBase *T) {
6029
- return T->getKind () == TypeKind::SequenceArchetype ;
6024
+ return T->getKind () == TypeKind::PackArchetype ;
6030
6025
}
6031
6026
6032
6027
private:
6033
- SequenceArchetypeType (const ASTContext &Ctx, GenericEnvironment *GenericEnv,
6034
- Type InterfaceType, ArrayRef<ProtocolDecl *> ConformsTo,
6035
- Type Superclass, LayoutConstraint Layout);
6028
+ PackArchetypeType (const ASTContext &Ctx, GenericEnvironment *GenericEnv,
6029
+ Type InterfaceType, ArrayRef<ProtocolDecl *> ConformsTo,
6030
+ Type Superclass, LayoutConstraint Layout);
6036
6031
};
6037
- BEGIN_CAN_TYPE_WRAPPER (SequenceArchetypeType , ArchetypeType)
6038
- END_CAN_TYPE_WRAPPER(SequenceArchetypeType , ArchetypeType)
6032
+ BEGIN_CAN_TYPE_WRAPPER (PackArchetypeType , ArchetypeType)
6033
+ END_CAN_TYPE_WRAPPER(PackArchetypeType , ArchetypeType)
6039
6034
6040
6035
template<typename Type>
6041
6036
const Type *ArchetypeType::getSubclassTrailingObjects() const {
@@ -6048,7 +6043,7 @@ const Type *ArchetypeType::getSubclassTrailingObjects() const {
6048
6043
if (auto openedTy = dyn_cast<OpenedArchetypeType>(this )) {
6049
6044
return openedTy->getTrailingObjects <Type>();
6050
6045
}
6051
- if (auto childTy = dyn_cast<SequenceArchetypeType >(this )) {
6046
+ if (auto childTy = dyn_cast<PackArchetypeType >(this )) {
6052
6047
return childTy->getTrailingObjects <Type>();
6053
6048
}
6054
6049
llvm_unreachable (" unhandled ArchetypeType subclass?" );
@@ -6067,7 +6062,7 @@ class GenericTypeParamType : public SubstitutableType {
6067
6062
6068
6063
public:
6069
6064
// / Retrieve a generic type parameter at the given depth and index.
6070
- static GenericTypeParamType *get (bool isTypeSequence , unsigned depth,
6065
+ static GenericTypeParamType *get (bool isParameterPack , unsigned depth,
6071
6066
unsigned index, const ASTContext &ctx);
6072
6067
6073
6068
// / Retrieve the declaration of the generic type parameter, or null if
@@ -6103,14 +6098,13 @@ class GenericTypeParamType : public SubstitutableType {
6103
6098
// / Here 'T' and 'U' have indexes 0 and 1, respectively. 'V' has index 0.
6104
6099
unsigned getIndex () const ;
6105
6100
6106
- // / Returns \c true if this generic type parameter is declared as a type
6107
- // / sequence.
6101
+ // / Returns \c true if this type parameter is declared as a pack.
6108
6102
// /
6109
6103
// / \code
6110
- // / func foo<@_typeSequence T>(_ : T ...) { }
6111
- // / struct Foo<@_typeSequence T > { }
6112
- // / \encode
6113
- bool isTypeSequence () const ;
6104
+ // / func foo<T ...>( ) { }
6105
+ // / struct Foo<T... > { }
6106
+ // / \endcode
6107
+ bool isParameterPack () const ;
6114
6108
6115
6109
// Implement isa/cast/dyncast/etc.
6116
6110
static bool classof (const TypeBase *T) {
@@ -6125,18 +6119,18 @@ class GenericTypeParamType : public SubstitutableType {
6125
6119
: SubstitutableType(TypeKind::GenericTypeParam, nullptr , props),
6126
6120
ParamOrDepthIndex(param) { }
6127
6121
6128
- explicit GenericTypeParamType (bool isTypeSequence , unsigned depth,
6122
+ explicit GenericTypeParamType (bool isParameterPack , unsigned depth,
6129
6123
unsigned index, RecursiveTypeProperties props,
6130
6124
const ASTContext &ctx)
6131
6125
: SubstitutableType(TypeKind::GenericTypeParam, &ctx, props),
6132
6126
ParamOrDepthIndex(depth << 16 | index |
6133
- ((isTypeSequence ? 1 : 0 ) << 30)) {}
6127
+ ((isParameterPack ? 1 : 0 ) << 30)) {}
6134
6128
};
6135
6129
BEGIN_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType)
6136
- static CanGenericTypeParamType get(bool isTypeSequence , unsigned depth,
6130
+ static CanGenericTypeParamType get(bool isParameterPack , unsigned depth,
6137
6131
unsigned index, const ASTContext &C) {
6138
6132
return CanGenericTypeParamType (
6139
- GenericTypeParamType::get (isTypeSequence , depth, index, C));
6133
+ GenericTypeParamType::get (isParameterPack , depth, index, C));
6140
6134
}
6141
6135
END_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType)
6142
6136
@@ -6475,8 +6469,8 @@ class PackExpansionType : public TypeBase, public llvm::FoldingSetNode {
6475
6469
// / a variadic generic parameter, but any variadic generic parameters
6476
6470
// / appearing in the pattern type must have the same count as \p countType.
6477
6471
// /
6478
- // / As for \p countType itself, it must be a type sequence generic parameter
6479
- // / type, or a sequence archetype type.
6472
+ // / As for \p countType itself, it must be a type parameter pack
6473
+ // / type, or a pack archetype type.
6480
6474
static PackExpansionType *get (Type pattern, Type countType);
6481
6475
6482
6476
public:
@@ -6548,14 +6542,14 @@ inline bool TypeBase::isTypeParameter() {
6548
6542
return t->is <GenericTypeParamType>();
6549
6543
}
6550
6544
6551
- inline bool TypeBase::isTypeSequenceParameter () {
6545
+ inline bool TypeBase::isParameterPack () {
6552
6546
Type t (this );
6553
6547
6554
6548
while (auto *memberTy = t->getAs <DependentMemberType>())
6555
6549
t = memberTy->getBase ();
6556
6550
6557
6551
return t->is <GenericTypeParamType>() &&
6558
- t->castTo <GenericTypeParamType>()->isTypeSequence ();
6552
+ t->castTo <GenericTypeParamType>()->isParameterPack ();
6559
6553
}
6560
6554
6561
6555
// TODO: This will become redundant once InOutType is removed.
@@ -6842,7 +6836,7 @@ constexpr bool TypeBase::isSugaredType<id##Type>() { \
6842
6836
#include " swift/AST/TypeNodes.def"
6843
6837
6844
6838
inline GenericParamKey::GenericParamKey (const GenericTypeParamType *p)
6845
- : TypeSequence (p->isTypeSequence ()), Depth(p->getDepth ()),
6839
+ : ParameterPack (p->isParameterPack ()), Depth(p->getDepth ()),
6846
6840
Index(p->getIndex ()) {}
6847
6841
6848
6842
inline TypeBase *TypeBase::getDesugaredType () {
0 commit comments