[6.2] Sema: Make @concurrent
not imply async
on closures
#83110
Merged
+96
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation:
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.
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.Scope: Type-checking for explicitly
@concurrent
closures.Issues: —
Original PRs: Sema: Make
@concurrent
not implyasync
on closures #83094.Risk: Overall low, medium for potentially existing adopters because closures that were previously inferred as async due to the attribute alone will now error.
Testing: Regression tests added, source compatibility suite run.
Reviewers: @xedin.