Skip to content

Cache absence of lifetime dependencies during deserialization #77016

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 1 commit into from
Oct 16, 2024

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Oct 15, 2024

Fixes rdar://136769990

Absence of lifetime dependencies weren't cached which resulted in running LifetimeDependence::infer on deserialized decls.

USRGenerationRequest::evaluate can call to InterfaceTypeRequest::evaluate which in turn calls LifetimeDependence::infer which ends up calling USRGenerationRequest::evaluate due to a call to getLoc() leading to circular reference errors in a previous revision of the compiler.

This isn't an existing issue on main because the call to getLoc() in LifetimeDependence::infer only happens when result is ~Escapable. Fixing this anyhow, to avoid LifetimeDependence::infer on deserialized decls.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta marked this pull request as ready for review October 15, 2024 17:14
@meg-gupta meg-gupta requested a review from xymus as a code owner October 15, 2024 17:14
@meg-gupta meg-gupta requested a review from atrick October 15, 2024 17:14
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! Since this was difficult to catch and reproduce, is there any way to add a deserialization test?

@meg-gupta
Copy link
Contributor Author

@atrick I added more details in the PR description. This does not cause "circular reference" errors on main. This PR is needed nevertheless to avoid calling into LifetimeDependence::infer on deserialized decls.

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test macOS platform

@meg-gupta meg-gupta enabled auto-merge October 16, 2024 19:00
@meg-gupta meg-gupta merged commit 3b358c5 into swiftlang:main Oct 16, 2024
4 of 5 checks passed
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.

2 participants