Skip to content
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

[SR-14960] Try to detect if continuation is known to not be resumed and emit warning #57302

Open
typesanitizer opened this issue Jul 23, 2021 · 1 comment
Labels
compiler The Swift compiler in itself improvement

Comments

@typesanitizer
Copy link

Previous ID SR-14960
Radar rdar://problem/80995926
Original Reporter @typesanitizer
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: e84eb2c1f41a9810e0beb09fb30b42a4

Issue Description:

The following code pattern is incorrect.

var local: CheckedContinuation<Void, Never>?
withCheckedContinuation { cont in
  local = cont
}

I was confused why this created a hang, then after talking to John, I realized I need to store the continuation on an actor's property, that way, some other task can come along and (thanks to actor reentrancy) access the property, optionally do some work and then resume the continuation.

If possible, it would be nice to have a warning for this kind of code.

@typesanitizer
Copy link
Author

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

1 participant