Skip to content

Commit f81a0d9

Browse files
committed
AST: Introduce AnyFunctionType::containsPackExpansionType()
1 parent 4733988 commit f81a0d9

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
@@ -3359,6 +3359,8 @@ class AnyFunctionType : public TypeBase {
33593359
/// replaced.
33603360
AnyFunctionType *withExtInfo(ExtInfo info) const;
33613361

3362+
static bool containsPackExpansionType(ArrayRef<Param> params);
3363+
33623364
static void printParams(ArrayRef<Param> Params, raw_ostream &OS,
33633365
const PrintOptions &PO = PrintOptions());
33643366
static void printParams(ArrayRef<Param> Params, ASTPrinter &Printer,

lib/AST/Type.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4282,6 +4282,15 @@ bool AnyFunctionType::hasSameExtInfoAs(const AnyFunctionType *otherFn) {
42824282
return getExtInfo().isEqualTo(otherFn->getExtInfo(), useClangTypes(this));
42834283
}
42844284

4285+
bool AnyFunctionType::containsPackExpansionType(ArrayRef<Param> params) {
4286+
for (auto param : params) {
4287+
if (param.getPlainType()->is<PackExpansionType>())
4288+
return true;
4289+
}
4290+
4291+
return false;
4292+
}
4293+
42854294
ClangTypeInfo SILFunctionType::getClangTypeInfo() const {
42864295
if (!Bits.SILFunctionType.HasClangTypeInfo)
42874296
return ClangTypeInfo();

0 commit comments

Comments
 (0)