File tree Expand file tree Collapse file tree 5 files changed +6
-11
lines changed Expand file tree Collapse file tree 5 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -653,8 +653,7 @@ std::string ASTMangler::mangleAutoDiffGeneratedDeclaration(
653
653
static Type getTypeForDWARFMangling (Type t) {
654
654
return t.subst (
655
655
[](SubstitutableType *t) -> Type {
656
- if (isa<GenericTypeParamType>(t) &&
657
- cast<GenericTypeParamType>(t)->isParameterPack ()) {
656
+ if (t->isRootParameterPack ()) {
658
657
return PackType::getSingletonPackExpansion (t->getCanonicalType ());
659
658
}
660
659
return t->getCanonicalType ();
Original file line number Diff line number Diff line change @@ -614,8 +614,7 @@ class Verifier : public ASTWalker {
614
614
auto countType = expansion->getCountType ();
615
615
if (!(countType->is <PackType>() ||
616
616
countType->is <PackArchetypeType>() ||
617
- (countType->is <GenericTypeParamType>() &&
618
- countType->castTo <GenericTypeParamType>()->isParameterPack ()))) {
617
+ countType->isRootParameterPack ())) {
619
618
Out << " non-pack shape type" << countType->getString () << " \n " ;
620
619
abort ();
621
620
}
Original file line number Diff line number Diff line change @@ -875,7 +875,7 @@ void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
875
875
abort ();
876
876
}
877
877
878
- if (!reqt.getFirstType ()->castTo <GenericTypeParamType>()-> isParameterPack ()) {
878
+ if (!reqt.getFirstType ()->isRootParameterPack ()) {
879
879
llvm::errs () << " Left hand side is not a parameter pack: " ;
880
880
reqt.dump (llvm::errs ());
881
881
llvm::errs () << " \n " ;
@@ -889,7 +889,7 @@ void GenericSignature::verify(ArrayRef<Requirement> reqts) const {
889
889
abort ();
890
890
}
891
891
892
- if (!reqt.getSecondType ()->castTo <GenericTypeParamType>()-> isParameterPack ()) {
892
+ if (!reqt.getSecondType ()->isRootParameterPack ()) {
893
893
llvm::errs () << " Right hand side is not a parameter pack: " ;
894
894
reqt.dump (llvm::errs ());
895
895
llvm::errs () << " \n " ;
Original file line number Diff line number Diff line change @@ -66,8 +66,7 @@ static Type transformTypeParameterPacksRec(
66
66
if (auto *paramType = dyn_cast<SubstitutableType>(t)) {
67
67
if (expansionLevel == 0 &&
68
68
(isa<PackArchetypeType>(paramType) ||
69
- (isa<GenericTypeParamType>(paramType) &&
70
- cast<GenericTypeParamType>(paramType)->isParameterPack ()))) {
69
+ paramType->isRootParameterPack ())) {
71
70
return fn (paramType);
72
71
}
73
72
Original file line number Diff line number Diff line change @@ -56,9 +56,7 @@ QueryTypeSubstitutionMapOrIdentity::operator()(SubstitutableType *type) const {
56
56
if (known != substitutions.end () && known->second )
57
57
return known->second ;
58
58
59
- if (isa<PackArchetypeType>(type) ||
60
- (isa<GenericTypeParamType>(type) &&
61
- cast<GenericTypeParamType>(type)->isParameterPack ())) {
59
+ if (isa<PackArchetypeType>(type) || type->isRootParameterPack ()) {
62
60
return PackType::getSingletonPackExpansion (type);
63
61
}
64
62
You can’t perform that action at this time.
0 commit comments