Commit Graph

2 Commits

Author SHA1 Message Date
Slava Pestov
d579a76581 Sema: Break request cycle when building TypeRefinementContexts
This fixes a recent regression introduced in the changes to make
TRC construction lazier in b33a71d64f.

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.
2023-12-01 22:49:20 -05:00
Doug Gregor
c098175059 Add test case involving circular references with @Observable
Add a test case for Observable types that are extended from other
source files. Prior to the recent changes to make
`TypeRefinementContext` more lazy, this would trigger circular
references through the `TypeRefinementContextBuilder`.

Finishes rdar://112079160.
2023-08-02 15:07:09 -07:00