@@ -8517,10 +8517,21 @@ class CopyableToMoveOnlyWrapperValueInst
85178517 DebugLoc, operand, operand->getType ().addingMoveOnlyWrapper(),
85188518 kind == InitialKind::Guaranteed ? OwnershipKind::Guaranteed
85198519 : OwnershipKind::Owned),
8520- initialKind(kind) {}
8520+ initialKind(kind) {
8521+ assert (!operand->getType ().isMoveOnly () &&
8522+ " Cannot be moveonly or moveonly wrapped" );
8523+ }
85218524
85228525public:
85238526 InitialKind getInitialKind () const { return initialKind; }
8527+
8528+ bool hasGuaranteedInitialKind () const {
8529+ return getInitialKind () == InitialKind::Guaranteed;
8530+ }
8531+
8532+ bool hasOwnedInitialKind () const {
8533+ return getInitialKind () == InitialKind::Owned;
8534+ }
85248535};
85258536
85268537// / Convert from an @moveOnly wrapper type to the underlying copyable type. Can
@@ -8569,10 +8580,21 @@ class MoveOnlyWrapperToCopyableValueInst
85698580 DebugLoc, operand, operand->getType ().removingMoveOnlyWrapper(),
85708581 kind == InitialKind::Guaranteed ? OwnershipKind::Guaranteed
85718582 : OwnershipKind::Owned),
8572- initialKind(kind) {}
8583+ initialKind(kind) {
8584+ assert (operand->getType ().isMoveOnlyWrapped () &&
8585+ " Expected moveonlywrapped argument!" );
8586+ }
85738587
85748588public:
85758589 InitialKind getInitialKind () const { return initialKind; }
8590+
8591+ bool hasGuaranteedInitialKind () const {
8592+ return getInitialKind () == InitialKind::Guaranteed;
8593+ }
8594+
8595+ bool hasOwnedInitialKind () const {
8596+ return getInitialKind () == InitialKind::Owned;
8597+ }
85768598};
85778599
85788600// / Convert a ${ @moveOnly T } to $T. This is a forwarding instruction that acts
@@ -8606,7 +8628,9 @@ class CopyableToMoveOnlyWrapperAddrInst
86068628
86078629 CopyableToMoveOnlyWrapperAddrInst (SILDebugLocation DebugLoc, SILValue operand)
86088630 : UnaryInstructionBase(DebugLoc, operand,
8609- operand->getType ().addingMoveOnlyWrapper()) {}
8631+ operand->getType ().addingMoveOnlyWrapper()) {
8632+ assert (!operand->getType ().isMoveOnly () && " Expected copyable argument" );
8633+ }
86108634};
86118635
86128636class MoveOnlyWrapperToCopyableAddrInst
@@ -8617,7 +8641,10 @@ class MoveOnlyWrapperToCopyableAddrInst
86178641
86188642 MoveOnlyWrapperToCopyableAddrInst (SILDebugLocation DebugLoc, SILValue operand)
86198643 : UnaryInstructionBase(DebugLoc, operand,
8620- operand->getType ().removingMoveOnlyWrapper()) {}
8644+ operand->getType ().removingMoveOnlyWrapper()) {
8645+ assert (operand->getType ().isMoveOnlyWrapped () &&
8646+ " Expected moveonlywrapped argument" );
8647+ }
86218648};
86228649
86238650// / Given an object reference, return true iff it is non-nil and refers
0 commit comments