Skip to content

Disallow attaching peer macro to variable with multiple bindings in assertMacroExpansion #2154

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

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 5, 2023

The compiler currently invokes expansion twice with the exact same syntax node (rdar://114996981), which causes the same member to be generated twice, effectively disallowing the application of peer macro on variables with multiple bindings. Disallow them in assertMacroExpansion with a nice error message.

@ahoppen
Copy link
Member Author

ahoppen commented Sep 5, 2023

@swift-ci Please test

@bnbarham
Copy link
Contributor

bnbarham commented Sep 6, 2023

I'd prefer just banning it. It's effectively banned in the compiler at the moment anyway, we just need to improve the error message :)

…assertMacroExpansion`

The compiler currently invokes `expansion` twice with the exact same syntax node (rdar://114996981), which causes the same member to be generated twice, effectively disallowing the application of peer macro on variables with multiple bindings. Disallow them in `assertMacroExpansion` with a nice error message.
@ahoppen ahoppen force-pushed the ahoppen/peer-on-var-with-multiple-bindings branch from 7c4a39e to 3ffa580 Compare September 6, 2023 01:10
@ahoppen ahoppen changed the title Add a test case to define the behavior of assertMacroExpansion when applied to a variable declaration with multiple bindings Disallow attaching peer macro to variable with multiple bindings in assertMacroExpansion Sep 6, 2023
@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2023

Updated the PR to ban peer macros on variables with multiple bindings in assertMacroExpansion.

@ahoppen ahoppen enabled auto-merge September 6, 2023 01:18
@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Sep 6, 2023

@swift-ci Please test Windows

@ahoppen ahoppen merged commit 452e07d into swiftlang:main Sep 6, 2023
@ahoppen ahoppen deleted the ahoppen/peer-on-var-with-multiple-bindings branch November 8, 2023 15:19
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.

2 participants