This has likely been posted, but I wanted to bring up this case again, from the AoC thread.
This error is especially confusing because it points to the closure being passed to addTask and not to the actual cause of the issue. While the closure type may technically be the cause of the issue, it's really caused by the closure type inference failing due to the code inside the closure. Is there any way the compiler can distinguish inferred types, especially for closures, and look at what cause the inference to return a different type than required? It could even be special cased to just closure parameters, as the closure itself doesn't usually feel like part of the code the user provides but something that the IDE/compiler/API gave us to fill in. Especially in Swift where the syntax is simply {}. Even something as simply as the compiler silently compiling a version of the closure as if it had an explicit return type that matched the parameter type (in this case { () async -> Int in }), which usually get the compiler to return the true errors.
