Skip to content

Commit 159807d

Browse files
committed
SILGen: Add an assertion to OpenOpaqueExistentialComponent
This component should only be used if the base is an opaque existential value; otherwise SIL has no way to express a projection of the payload.
1 parent 8ba21d8 commit 159807d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ namespace {
587587
"base for open existential component must be an existential");
588588
assert(base.getType().isAddress() &&
589589
"base value of open-existential component was not an address?");
590+
assert(base.getType().getPreferredExistentialRepresentation(SGF.SGM.M)
591+
== ExistentialRepresentation::Opaque);
590592

591593
SILValue addr = SGF.B.createOpenExistentialAddr(
592594
loc, base.getValue(), getTypeOfRValue().getAddressType(),

0 commit comments

Comments
 (0)