Skip to content

[Macros] Put the insertion location for freestanding macros at the beginning #74925

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

When building the ASTScope tree, we set the insertion location for the macro expansion just before the end of the macro use. This is the right approach for attached macros, because we need to put the entities after the macro.

However, for freestanding macros, which can have trailing closures, this location is a problem, because the scope for the macro expansion ends up inside the scope for the trailing closure. Use the start location of the freestanding macro instead.

Fixes rdar://130923190.

…ginning

When building the ASTScope tree, we set the insertion location for the
macro expansion just before the end of the macro use. This is the right
approach for attached macros, because we need to put the entities
after the macro.

However, for freestanding macros, which can have trailing closures,
this location is a problem, because the scope for the macro
expansion ends up inside the scope for the trailing closure. Use the
start location of the freestanding macro instead.

Fixes rdar://130923190.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 0441436 into swiftlang:main Jul 3, 2024
3 checks passed
@DougGregor DougGregor deleted the astscope-insertion-loc-freestanding branch July 3, 2024 18:20
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