`withCheckedThrowingContinuation` fails to resolve `T` in `Void` context

I'm trying to understand why withCheckedThrowingContinuation is incapable of inferring T as Void in the following context:

public func join(organizationWithEmail email: String) async throws {
    try await withCheckedThrowingContinuation { continuation in
        if email.isEmpty {
            continuation.resume()
        } else {
            continuation.resume()
        }
    }
}

It would appear that the if is somehow culpable in causing the issue to arise. Removing the if or explicitly declaring continuation's type avoids the issue. Any thoughts what's going on?

Prior to Swift 5.7, Swift was unable to infer the return type of multi statement closures, even in cases where there's no return at all. In Swift 5.7 this is usually fixed. Additionally, using a ternary, given that it's a single statement, may help in some cases. I can confirm your example compiles correctly in 5.7 (Xcode 14b1).

That's interesting; given that the compiler doesn't need to infer the return value of the multi-statement block, and the block where it does need to infer a return value is in fact a single statement.

Thanks for verifying!