@@ -430,6 +430,40 @@ AbstractionPattern::getTupleElementType(unsigned index) const {
430
430
llvm_unreachable (" bad kind" );
431
431
}
432
432
433
+ bool AbstractionPattern::doesTupleContainPackExpansionType () const {
434
+ switch (getKind ()) {
435
+ case Kind::Invalid:
436
+ llvm_unreachable (" querying invalid abstraction pattern!" );
437
+ case Kind::Opaque:
438
+ case Kind::PartialCurriedObjCMethodType:
439
+ case Kind::CurriedObjCMethodType:
440
+ case Kind::CFunctionAsMethodType:
441
+ case Kind::CurriedCFunctionAsMethodType:
442
+ case Kind::PartialCurriedCFunctionAsMethodType:
443
+ case Kind::ObjCMethodType:
444
+ case Kind::CXXMethodType:
445
+ case Kind::CurriedCXXMethodType:
446
+ case Kind::PartialCurriedCXXMethodType:
447
+ case Kind::OpaqueFunction:
448
+ case Kind::OpaqueDerivativeFunction:
449
+ llvm_unreachable (" pattern is not a tuple" );
450
+ case Kind::Tuple: {
451
+ for (auto &elt : llvm::makeArrayRef (OrigTupleElements,
452
+ getNumTupleElements_Stored ())) {
453
+ if (elt.isPackExpansion ())
454
+ return true ;
455
+ }
456
+ return true ;
457
+ }
458
+ case Kind::ObjCCompletionHandlerArgumentsType:
459
+ case Kind::Type:
460
+ case Kind::Discard:
461
+ case Kind::ClangType:
462
+ return cast<TupleType>(getType ()).containsPackExpansionType ();
463
+ }
464
+ llvm_unreachable (" bad kind" );
465
+ }
466
+
433
467
static CanType getCanPackElementType (CanType type, unsigned index) {
434
468
return cast<PackType>(type).getElementType (index);
435
469
}
0 commit comments