[6.2][TypeChecker] Allow closures to assume nonisolated(nonsending)
#80924
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.
Cherry-pick of #80872
Explanation:
Fixes a bug where closures passed to
nonisolated(nonsending)
parameter would hopto a wrong isolation context.
Always infer
nonisolated(nonsending)
from context directly on a closure unless theclosure is marked as
@concurrent
, otherwise the closure is not going to get correctisolation and going to hop to the wrong executor in its preamble.
Main Branch PR: [TypeChecker] Allow closures to assume
nonisolated(nonsending)
#80872Risk: Low (No source compatibility impact since it only applies to APIs that would have adopted the specifier explicitly).
Reviewed By: @ktoso @hborla
Resolves: rdar://149107104
Testing: Added new tests to the test suite.