Skip to content

[5.9] Improve breaking of cyclic references for member-attribute macros #65411

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

Conversation

DougGregor
Copy link
Member

We are likely to debugging more cyclic references involving macros in
the future, so improve the diagnostics to specify what operation we're
performing (e.g., macro resolution vs. expansion of a particular kind
of macro) and the macro name, when possible, so failures are easier to
diagnose. No functionality change for well-formed code.
…acro is attached

The macro-resolution request for an attached macro was expressed in
terms of the custom attribute and the declaration context enclosing the
attribute. While the declaration context is the correct one for
resolving the types and arguments of the custom attribute, the
declaration provides a better anchor for cases where the same
attribute applies to multiple declarations, e.g., with
member-attribute macros, leading to false cyclic references.
…mber attributes

The last step in breaking the cycle through visible declaration lookup,
e.g., with invalid code. Prior to this, we would get a false cyclic
reference through the parameters of a function when they try to find
property wrappers on the parameters.
@DougGregor DougGregor requested a review from a team as a code owner April 25, 2023 04:37
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test macOS

@DougGregor DougGregor merged commit a4834b3 into swiftlang:release/5.9 Apr 25, 2023
@DougGregor DougGregor deleted the macro-cycle-break-part-deux-5.9 branch April 25, 2023 19:34
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants