-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Requestify AbstractStorageDecl::hasStorage()
.
#66482
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
@swift-ci please smoke test |
245a3d5
to
5be151e
Compare
@swift-ci please smoke test |
@swift-ci please test source compatibility |
5be151e
to
655f35c
Compare
@swift-ci please clean smoke test |
The `hasStorage()` computation is used in many places to determine the signatures of other declarations. It currently needs to expand accessor macros, which causes a number of cyclic references. Provide a simplified request to determine `hasStorage` without expanding or resolving macros, breaking a common pattern of cycles when using macros. Fixes rdar://109668383.
… impl info Slightly cleanup, and make an assertion less strict in the face of invalid code.
Now that we've made accessor macro expansion more lazy, ensure that when querying for init accessors (e.g., to build a memberwise initializer), we also expand any accessor macros that might produce an init accessor. This is a partial step toward the real goal, which is that `AbstractStorageDecl::getAccessor()` should lazily expand macros if needed. Update the Observable macro to document that it produces an `init` accessor.
Remove an early iteration of cycle-breaking in `PatternBindingEntryRequest` that has been subsumed by the lazy computation of `AbstractStorageDecl::hasStorage()`. We can now directly use `hasStorage()` here.
655f35c
to
5457290
Compare
@swift-ci please smoke test |
#if OBSERVATION_SUPPORTS_PEER_MACROS | ||
@attached(peer, names: prefixed(_)) | ||
#endif | ||
public macro ObservationTracked() = | ||
#externalMacro(module: "ObservationMacros", type: "ObservationTrackedMacro") | ||
|
||
@available(SwiftStdlib 5.9, *) | ||
@attached(accessor) | ||
@attached(accessor, names: named(willSet)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi everyone,
I was reviewing this old PR and came across the names: named(willSet)
argument. I don't get why this has been added. Does anyone recall the specific reason for adding this?
The
hasStorage()
computation is used in many places to determine the signatures of other declarations. It currently needs to expand accessor macros, which causes a number of cyclic references. Provide a simplified request to determinehasStorage
without expanding or resolving macros, breaking a common pattern of cycles when using macros.Fixes rdar://109668383.