Skip to content

Commit 79c4cfb

Browse files
committed
[NFC] Replace a few calls to TypeBase::isParameterPack() with isRootParameterPack().
1 parent 7b586d2 commit 79c4cfb

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,7 @@ std::string ASTMangler::mangleAutoDiffGeneratedDeclaration(
653653
static Type getTypeForDWARFMangling(Type t) {
654654
return t.subst(
655655
[](SubstitutableType *t) -> Type {
656-
if (isa<GenericTypeParamType>(t) &&
657-
cast<GenericTypeParamType>(t)->isParameterPack()) {
656+
if (t->isRootParameterPack()) {
658657
return PackType::getSingletonPackExpansion(t->getCanonicalType());
659658
}
660659
return t->getCanonicalType();

lib/AST/ASTVerifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,7 @@ class Verifier : public ASTWalker {
614614
auto countType = expansion->getCountType();
615615
if (!(countType->is<PackType>() ||
616616
countType->is<PackArchetypeType>() ||
617-
(countType->is<GenericTypeParamType>() &&
618-
countType->castTo<GenericTypeParamType>()->isParameterPack()))) {
617+
countType->isRootParameterPack())) {
619618
Out << "non-pack shape type" << countType->getString() << "\n";
620619
abort();
621620
}

lib/AST/GenericSignature.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
875875
abort();
876876
}
877877

878-
if (!reqt.getFirstType()->castTo<GenericTypeParamType>()->isParameterPack()) {
878+
if (!reqt.getFirstType()->isRootParameterPack()) {
879879
llvm::errs() << "Left hand side is not a parameter pack: ";
880880
reqt.dump(llvm::errs());
881881
llvm::errs() << "\n";
@@ -889,7 +889,7 @@ void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
889889
abort();
890890
}
891891

892-
if (!reqt.getSecondType()->castTo<GenericTypeParamType>()->isParameterPack()) {
892+
if (!reqt.getSecondType()->isRootParameterPack()) {
893893
llvm::errs() << "Right hand side is not a parameter pack: ";
894894
reqt.dump(llvm::errs());
895895
llvm::errs() << "\n";

lib/AST/ParameterPack.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ static Type transformTypeParameterPacksRec(
6666
if (auto *paramType = dyn_cast<SubstitutableType>(t)) {
6767
if (expansionLevel == 0 &&
6868
(isa<PackArchetypeType>(paramType) ||
69-
(isa<GenericTypeParamType>(paramType) &&
70-
cast<GenericTypeParamType>(paramType)->isParameterPack()))) {
69+
paramType->isRootParameterPack())) {
7170
return fn(paramType);
7271
}
7372

lib/AST/TypeSubstitution.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ QueryTypeSubstitutionMapOrIdentity::operator()(SubstitutableType *type) const {
5656
if (known != substitutions.end() && known->second)
5757
return known->second;
5858

59-
if (isa<PackArchetypeType>(type) ||
60-
(isa<GenericTypeParamType>(type) &&
61-
cast<GenericTypeParamType>(type)->isParameterPack())) {
59+
if (isa<PackArchetypeType>(type) || type->isRootParameterPack()) {
6260
return PackType::getSingletonPackExpansion(type);
6361
}
6462

0 commit comments

Comments
 (0)