Skip to content

Commit 52dba17

Browse files
committed
Opened existential types aren't always ExistentialType.
As with many other places in the frontend, grab the constraint type when from an existential type when we have one.
1 parent 196a4d2 commit 52dba17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/SILGen/ResultPlan.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ mapTypeOutOfOpenedExistentialContext(CanType t) {
9999
/*type sequence*/ false, /*depth*/ 0, /*index*/ i, ctx);
100100
params.push_back(param);
101101

102-
const auto constraintTy = openedTypes[i]
103-
->getExistentialType()
104-
->castTo<ExistentialType>()
105-
->getConstraintType();
102+
Type constraintTy = openedTypes[i]->getExistentialType();
103+
if (auto existentialTy = constraintTy->getAs<ExistentialType>())
104+
constraintTy = existentialTy->getConstraintType();
105+
106106
requirements.emplace_back(RequirementKind::Conformance, param,
107107
constraintTy);
108108
}

0 commit comments

Comments
 (0)