Skip to content

Commit 69c998f

Browse files
committed
[Constraint system] Have simplifyOpenedExistentialOfConstraint use openExistentialType
... rather than re-implementing it.
1 parent 8224335 commit 69c998f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10128,18 +10128,8 @@ ConstraintSystem::simplifyOpenedExistentialOfConstraint(
1012810128
if (type2->isAnyExistentialType()) {
1012910129
// We have the existential side. Produce an opened archetype and bind
1013010130
// type1 to it.
10131-
bool isMetatype = false;
10132-
auto instanceTy = type2;
10133-
if (auto metaTy = type2->getAs<ExistentialMetatypeType>()) {
10134-
isMetatype = true;
10135-
instanceTy = metaTy->getExistentialInstanceType();
10136-
}
10137-
assert(instanceTy->isExistentialType());
10138-
Type openedTy =
10139-
OpenedArchetypeType::get(instanceTy->getCanonicalType(),
10140-
DC->getGenericSignatureOfContext());
10141-
if (isMetatype)
10142-
openedTy = MetatypeType::get(openedTy, getASTContext());
10131+
Type openedTy = openExistentialType(type2, getConstraintLocator(locator))
10132+
.first;
1014310133
return matchTypes(type1, openedTy, ConstraintKind::Bind, subflags, locator);
1014410134
}
1014510135
if (!type2->isTypeVariableOrMember())

0 commit comments

Comments
 (0)