swift
dc145876 - Sema: Make `@concurrent` not imply `async` on closures

Commit
80 days ago
Sema: Make `@concurrent` not imply `async` on closures The present approach is not prudent because `@concurrent` synchronous functions, a natural extension, are a likely-to-happen future direction, whereas the current inference rule is entirely grounded on `@concurrent` being exclusive to async functions. If we were to ship this rule, we would have to keep the promise for backwards compatibility when implementing the aforementioned future direction, replacing one inconsistency with another, and possibly introducing new bug-prone expression checking code. ```swift func foo(_: () -> Void) {} func foo(_: () async -> Void) {} // In a future without this change and `@concurrent` synchronous // functions accepted, the first call resolves to the first overload, // and the second call resolves to the second, despite `@concurrent` no // longer implying `async`. foo { } foo { @concurrent in } ``` This change also drops the fix-it for removing `@concurrent` when used on a synchronous closure. With the inference rule gone, and the diagnosis delayed until after solution application, this error raises a fairly balanced choice between removing the attribute and being explicit about the effect, where a unilateral suggestion is quite possibly more harmful than useful. (cherry picked from commit 58d505961761d95cfd7a02c325baa6d4949ac499)
Author
Committer
Parents
Loading