Skip to content

Commit ff9085c

Browse files
committed
Make sure open existential ref only takes objects.
We already have this assert in the verifier, but by placing the assert here we catch the error right where the error occurs instead of later. This just lowers triage time for such errors.
1 parent 9e1684a commit ff9085c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SIL/SILInstructions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,8 @@ OpenExistentialAddrInst::OpenExistentialAddrInst(
17621762
OpenExistentialRefInst::OpenExistentialRefInst(
17631763
SILDebugLocation DebugLoc, SILValue Operand, SILType Ty)
17641764
: UnaryInstructionBase(DebugLoc, Operand, Ty) {
1765+
assert(Operand->getType().isObject() && "Operand must be an object.");
1766+
assert(Ty.isObject() && "Result type must be an object type.");
17651767
}
17661768

17671769
OpenExistentialMetatypeInst::OpenExistentialMetatypeInst(

0 commit comments

Comments
 (0)