Skip to content

Commit f93620f

Browse files
committed
AST: Simplify PackExpansionType::getReducedShape()
1 parent f711df1 commit f93620f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/AST/ParameterPack.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,11 @@ PackExpansionType *PackExpansionType::expand() {
141141
}
142142

143143
CanType PackExpansionType::getReducedShape() {
144-
if (auto *archetypeType = countType->getAs<PackArchetypeType>()) {
145-
auto shape = archetypeType->getReducedShape();
146-
return CanType(PackExpansionType::get(shape, shape));
147-
} else if (auto *packType = countType->getAs<PackType>()) {
148-
auto shape = packType->getReducedShape();
149-
return CanType(PackExpansionType::get(shape, shape));
150-
}
144+
auto reducedShape = countType->getReducedShape();
145+
if (reducedShape == getASTContext().TheEmptyTupleType)
146+
return reducedShape;
151147

152-
assert(countType->is<PlaceholderType>());
153-
return getASTContext().TheEmptyTupleType;
148+
return CanType(PackExpansionType::get(reducedShape, reducedShape));
154149
}
155150

156151
bool TupleType::containsPackExpansionType() const {

0 commit comments

Comments
 (0)