Skip to content

Commit 043d2aa

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`.
1 parent 281207f commit 043d2aa

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
@@ -11610,16 +11610,13 @@ bool ConstraintSystem::resolveKeyPath(TypeVariableType *typeVar,
1161011610

1161111611
bool ConstraintSystem::resolvePackExpansion(TypeVariableType *typeVar,
1161211612
Type contextualType) {
11613-
auto *locator = typeVar->getImpl().getLocator();
11613+
assert(typeVar->getImpl().isPackExpansion());
1161411614

11615-
Type openedExpansionType;
11616-
if (auto expansionElt =
11617-
locator->getLastElementAs<LocatorPathElt::PackExpansionType>()) {
11618-
openedExpansionType = expansionElt->getOpenedType();
11619-
}
11615+
auto *locator = typeVar->getImpl().getLocator();
1162011616

11621-
if (!openedExpansionType)
11622-
return false;
11617+
Type openedExpansionType =
11618+
locator->castLastElementTo<LocatorPathElt::PackExpansionType>()
11619+
.getOpenedType();
1162311620

1162411621
assignFixedType(typeVar, openedExpansionType, locator);
1162511622

0 commit comments

Comments
 (0)