Skip to content

[region-isolation] Transferring results shouldn't have the following error emitted: "non-sendable type 'NonSendableKlass' returned by implicitly asynchronous call to main actor-isolated function cannot cross actor boundary" #71940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

gottesmm
Copy link
Contributor

In this PR, I am chopping down a larger PR to make it easier to get in. This does the following:

  1. Transferring results shouldn't have the following error emitted: "non-sendable type 'NonSendableKlass' returned by implicitly asynchronous call to main actor-isolated function cannot cross actor boundary". Transferring makes this safe, so I taught Sema to suppress this. We still do not get the correct behavior for async let... but I am working on that in a separate PR.
  2. I improved how we print transferring. This included putting in a missing space in the AST printing and printing transferring_result on AST types that have a transferring result. Finally, it fixes usesFeatureTransferringArgsAndResults so we properly trigger if a function decl uses that feature.
  3. While doing other work in async let, I noticed that we did not handle the case of an async let without any captured parameters correctly (we would crash in a dyn_cast). I think we might have gotten lucky and gotten it to work without asserts, but with this fix, we represent the behavior explicitly and correctly.
  4. Finally I noticed that the strongly_transferring tests did not have strict-concurrency enabled. I enabled them on the test s and added an assert that if region isolation is enabled, then strict concurrency must also be enabled.

rdar://123712033

… well as our experimental features.

Just noticed this while trying to write some tests that validated that we were
properly ignoring strict-concurrency features. I put in asserts to validate that
when either of these are enabled, we have strict-concurrency set as well.
…r emitted: "non-sendable type 'NonSendableKlass' returned by implicitly asynchronous call to main actor-isolated function cannot cross actor boundary"

Transferring makes this safe.

rdar://123712033
…any captures correctly.

Previously, we assumed we would always have a partial_apply. In the case where
we do not capture any values this is not true since we instead have a
thin_to_thick_function.
Specifically:

1. Previously when printing we would not put a space after transferring.
2. When a function type has a transferring result, we wouldn't print it when dumping.
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

1 similar comment
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm
Copy link
Contributor Author

@swift-ci test windows platform

@gottesmm gottesmm enabled auto-merge February 29, 2024 18:21
@gottesmm
Copy link
Contributor Author

Windows failed b/c of something unrelated in Foundation

@gottesmm gottesmm merged commit 3bdeb57 into swiftlang:main Feb 29, 2024
@gottesmm gottesmm deleted the layer-of-onion branch February 29, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant