title: Xcode 14 beta 4 - warnings about unused return values even when using @discardableResult
body: <p>In Xcode 14 beta 4 (and perhaps earlier betas but I haven't checked) I'm seeing warnings about unused return values even though the methods are annotated with <code>@discardableResult</code>. These warnings only surface for <code>async</code> methods, and as far as I can tell, only in extensions on <code>UIKit</code> classes:</p>
  <pre><code>import UIKit
  
  extension UIView {
    @discardableResult
    func discardableUIKit() async -&gt; Int {
      42
    }
  
    @discardableResult
    func discardableUIKit() -&gt; Int {
      42
    }
  }
  
  extension NSObject {
    @discardableResult
    func discardableNSObject() async -&gt; Int {
      42
    }
  
    @discardableResult
    func discardableNSObject() -&gt; Int {
      42
    }
  }
  
  extension NSNumber {
    @discardableResult
    func discardableNSNumber() async -&gt; Int {
      42
    }
  
    @discardableResult
    func discardableNSNumber() -&gt; Int {
      42
    }
  }
  
  func test() {
    UIView().discardableUIKit()
    NSNumber().discardableNSObject()
    NSNumber().discardableNSNumber()
    Task {
      await UIView().discardableUIKit() // Result of call to function returning 'Int' is unused
      await NSNumber().discardableNSObject()
      await NSNumber().discardableNSNumber()
    }
  }
  </code></pre>
  <p>I don't see these warnings in Xcode 13. Is this a bug or something new to Xcode 14/Swift 5.7 that I'm unaware of?</p>
  <h1>Update</h1>
  <p>As mentioned in the comments, this is a bug with Swift 5.7 that affects any type that is annotated with <code>@MainActor</code>. Presumably it will be fixed before the GM is released, but it is still present in Xcode 14 beta 5.</p>