Skip to content

Sema: Break request cycle when building TypeRefinementContexts #70178

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
Dec 2, 2023

Conversation

slavapestov
Copy link
Contributor

This fixes a recent regression introduced in the changes to make TRC construction lazier in b33a71d.

Calling VarDecl::hasInitialValue() can ask for attached property wrappers, which can trigger macro expansion. However, macro expansion can result in TRC construction, causing a cycle.

Instead, just always build a lazy TRC for the initializer. It might not be needed, but it's safest to not ask anything of the VarDecl at all.

Fixes rdar://118452948.

@slavapestov slavapestov requested review from a team, hborla, xedin and tshortli as code owners December 2, 2023 03:43
This fixes a recent regression introduced in the changes to make
TRC construction lazier in b33a71d.

Calling VarDecl::hasInitialValue() can ask for attached property
wrappers, which can trigger macro expansion. However, macro
expansion can result in TRC construction, causing a cycle.

Instead, just always build a lazy TRC for the initializer. It
might not be needed, but it's safest to not ask anything of the
VarDecl at all.

Fixes rdar://118452948.
@slavapestov slavapestov force-pushed the trc-cycle-rdar118452948 branch from 03ed7ca to d579a76 Compare December 2, 2023 03:49
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 26a5e56 into swiftlang:main Dec 2, 2023
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