[6.2][Concurrency] Prevent some extraneous function conversion sendability checking #84495
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:
Fixes a few situations where Sendable checking was performed on conversions that don't require it.
Fixes
@Sendable
closures not inferringnonisolated(nonsending)
If there are no explicit concurrency attributes, isolated parameters, or captures associated with the closure it should infer
nonisolated(nonsending)
for the parent conversion injected by the solver (this conversion is injected because the solver cannot check captures to elide it).Moves function conversion check from pre-walk to post-walk. This makes sure that sub-expressions have their isolation computed (especially imported for closures) before checking is performed. The checking itself is idempotent.
Skips checking when function conversion is used to erase
@Sendable
fromnonisolated(nonsending)
function type, this doesn't require a thunk and so there is no possibility of isolation boundary crossing.Detects situations when function conversion is used to apply
nonisolated(nonsending)
attribute to interface type of a declaration.Resolves: rdar://157663660
Main Branch PR: [Concurrency] Fix
@Sendable
closures not inferring `nonisolated(non… #84117, [Concurrency] Prevent some extraneous function conversion sendability checking #84409Risk: Low. This is a narrow fix that prevents some checks from happening and results in more code accepted by the compiler.
Reviewed By: @hborla
Testing: Added new test-cases to the suite.