Skip to content

[Test] Checked variable lifetimes extend self. #40744

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

Conversation

nate-chandler
Copy link
Contributor

Verified that when a __consuming method calls a function which takes a closure that captures self weakly, self is not deallocated until the call returns. (Note that this is a behavioral change from what occurs when lexical borrow scopes are disabled; in that case, self is deallocated before the call to the function.)

Verified that when a __consuming method calls a function which takes a
closure that captures self weakly, self is not deallocated until the
call returns.  (Note that this is a behavioral change from what occurs
when lexical borrow scopes are disabled; in that case, self is
deallocated before the call to the function.)
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler requested a review from atrick January 5, 2022 20:20
Verified that lexical lifetimes DO NOT result in a method call to a weak
reference resulting in a strong reference to the object.  Consequently,
even with lexical lifetimes enabled, it is still possible, within a
single scope, for the first method call to an object weakly referenced
to occur but for the second such call not to because the object will
have been deallocated.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 5, 2022

Build failed
Swift Test Linux Platform
Git Sha - cb205a6

@nate-chandler
Copy link
Contributor Author

@swift-ci please clean test linux platform

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That tests the behavior that I expect.

@atrick
Copy link
Contributor

atrick commented Jan 6, 2022

@Catfish-Man do these two tests, the sync test and the async test, match your expectations for behavior with lexical lifetimes enabled?

@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler merged commit 79f9a59 into swiftlang:main Jan 10, 2022
@nate-chandler nate-chandler deleted the lexical_lifetimes/test/verification/20220105/1 branch January 10, 2022 22:16
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.

3 participants