Skip to content

Commit 4224fd1

Browse files
committed
[CSSimplify] NFC: Straighten checking of type variable passed to resolvePackExpansion
The type variable should always be one for pack expansion type which implies that locator always ends at `PackExpansionType`. (cherry picked from commit 043d2aa)
1 parent 2211b2c commit 4224fd1

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11492,16 +11492,13 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
1149211492

1149311493
bool ConstraintSystem::resolvePackExpansion(TypeVariableType *typeVar,
1149411494
Type contextualType) {
11495-
auto *locator = typeVar->getImpl().getLocator();
11495+
assert(typeVar->getImpl().isPackExpansion());
1149611496

11497-
Type openedExpansionType;
11498-
if (auto expansionElt =
11499-
locator->getLastElementAs<LocatorPathElt::PackExpansionType>()) {
11500-
openedExpansionType = expansionElt->getOpenedType();
11501-
}
11497+
auto *locator = typeVar->getImpl().getLocator();
1150211498

11503-
if (!openedExpansionType)
11504-
return false;
11499+
Type openedExpansionType =
11500+
locator->castLastElementTo<LocatorPathElt::PackExpansionType>()
11501+
.getOpenedType();
1150511502

1150611503
assignFixedType(typeVar, openedExpansionType, locator);
1150711504

0 commit comments

Comments
 (0)