Skip to content

Commit 511dad5

Browse files
committed
[Sema/SIL] NFC: Get existential layout directly from an existential type
1 parent 3d6ddd5 commit 511dad5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/SIL/IR/SILInstructions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,8 +2971,7 @@ BoundGenericType *KeyPathInst::getKeyPathType() const {
29712971
auto kpTy = getType();
29722972

29732973
if (auto existential = kpTy.getAs<ExistentialType>()) {
2974-
auto containedTy = existential->getConstraintType();
2975-
return containedTy->getExistentialLayout()
2974+
return existential->getExistentialLayout()
29762975
.explicitSuperclass->castTo<BoundGenericType>();
29772976
}
29782977

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5010,8 +5010,7 @@ namespace {
50105010
leafTy = fnTy->getResult();
50115011
isFunctionType = true;
50125012
} else if (auto *existential = exprType->getAs<ExistentialType>()) {
5013-
auto constrainedTy = existential->getConstraintType();
5014-
auto layout = constrainedTy->getExistentialLayout();
5013+
auto layout = existential->getExistentialLayout();
50155014
auto keyPathTy = layout.explicitSuperclass->castTo<BoundGenericType>();
50165015
baseTy = keyPathTy->getGenericArgs()[0];
50175016
leafTy = keyPathTy->getGenericArgs()[1];

0 commit comments

Comments
 (0)