Skip to content

Commit 4733988

Browse files
committed
AST: Add TupleType::containsPackExpansionType() utility method
1 parent fec6c06 commit 4733988

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/swift/AST/Types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,8 @@ class TupleType final : public TypeBase, public llvm::FoldingSetNode,
23232323
static void Profile(llvm::FoldingSetNodeID &ID,
23242324
ArrayRef<TupleTypeElt> Elements);
23252325

2326+
bool containsPackExpansionType() const;
2327+
23262328
private:
23272329
TupleType(ArrayRef<TupleTypeElt> elements, const ASTContext *CanCtx,
23282330
RecursiveTypeProperties properties)

lib/AST/Type.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,15 @@ int TupleType::getNamedElementId(Identifier I) const {
34593459
return -1;
34603460
}
34613461

3462+
bool TupleType::containsPackExpansionType() const {
3463+
for (auto elt : getElements()) {
3464+
if (elt.getType()->is<PackExpansionType>())
3465+
return true;
3466+
}
3467+
3468+
return false;
3469+
}
3470+
34623471
ArchetypeType::ArchetypeType(TypeKind Kind,
34633472
const ASTContext &Ctx,
34643473
RecursiveTypeProperties properties,

0 commit comments

Comments
 (0)