Skip to content

[Macros] Mangle attached macro expansions based only on syntactic information #65032

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

The mangling of attached macro expansions based on the declaration to which they are attached requires semantic information (specifically, the interface type of that declaration) that caused cyclic dependencies during type checking. Replace the mangling with a less-complete mangling that only requires syntactic information from the declaration, i.e., the name of the declaration to which the macro was attached.

This eliminates reference cycles that occur with attached macros that produce arbitrary names.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please clean test Linux

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please clean test Linux

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

…ormation

The mangling of attached macro expansions based on the declaration to
which they are attached requires semantic information (specifically,
the interface type of that declaration) that caused cyclic
dependencies during type checking. Replace the mangling with a
less-complete mangling that only requires syntactic information from
the declaration, i.e., the name of the declaration to which the macro
was attached.

This eliminates reference cycles that occur with attached macros that
produce arbitrary names.
…ssors

Adding accessors to a stored property, which removes its initializer.
Force computation of the interface type first.

There are better ways to model this in the AST, but it requires
reworking how we handle initializers to break them into requests.
@DougGregor DougGregor force-pushed the attached-macro-mangle-without-cycles branch from 2a17401 to fb82b8f Compare April 12, 2023 03:41
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please clean smoke test

@xedin xedin removed their request for review April 12, 2023 16:52
@DougGregor DougGregor merged commit 2bcef82 into swiftlang:main Apr 12, 2023
@DougGregor DougGregor deleted the attached-macro-mangle-without-cycles branch April 12, 2023 16:58
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