title: field `accessory` of type `Transaction` is not invalidated (moved or destroyed). not invalidated - flow cadence
body: <p>I'm developing a game and I have an avatar resource with the following definition that stores accessory NFTs and includes an equip function that returns any accessory that was existing in the slot</p>
  <pre><code>pub resource Avatar {
          pub let id: UInt64
          pub let accessories: @{String: Accessory}
  
          init() {
              self.id = Avatar.totalMinted + 1
              self.accessories &lt;- {}
  
              Avatar.totalMinted = Avatar.totalMinted + 1
          }
  
          destroy () {
              Avatar.totalAvatars = Avatar.totalAvatars - 1
              destroy self.accessories
          }
  
          pub fun equip(accessory: @Accessory): @Accessory? {
              // Shift accessory into accessories dictionary and return old accessory
              let oldAccessory &lt;- self.accessories[accessory.getAccessoryData().slot] &lt;- accessory
              return &lt;- oldAccessory
  
          }
  }
  </code></pre>
  <p>Now in my transaction I get the accessory from my collection and equip it, making sure i deposit the old accessory in the slot if that exists.</p>
  <pre><code>import Avatar from 0x03
  import NonFungibleToken from 0x01
  transaction(avatarId: UInt64, accessoryId: UInt64) {
      
      let collection: &amp;Avatar.Collection
      let avatar: auth &amp;Avatar.Avatar
      let accessory: @Avatar.Accessory
  
      prepare(signer: AuthAccount) {
          self.collection = signer.borrow&lt;&amp;Avatar.Collection&gt;(from: Avatar.CollectionStoragePath) ?? panic(&quot;could not borrow collection&quot;)
          self.avatar = self.collection.borrowAuth(id: avatarId) as? auth &amp;Avatar.Avatar ?? panic(&quot;problem&quot;)
          self.accessory &lt;- self.collection.withdraw(withdrawID: accessoryId) as! @Avatar.Accessory
      }
  
      execute {
          if let oldAccessory &lt;- self.avatar.equip(accessory: &lt;- self.accessory) {
              self.collection.deposit(token: &lt;- oldAccessory)
          }
  
      }
  }
  </code></pre>
  <p>I get the error field <code>accessory</code> of type <code>Transaction</code> is not invalidated (moved or destroyed). not invalidated - flow cadence</p>
  <p>I have a feeling the type checker may not understand that the resource should be moved/destroyed by the end of this but maybe it's confused since it hands over the custody to Avatar.</p>
  <p>Am I missing something?</p>