Skip to content

fix: expand peer macros for multi-binding variables - #3394

Open
raisulchowdhury wants to merge 1 commit into
swiftlang:mainfrom
raisulchowdhury:fix/3320-peer-macro-multibinding
Open

fix: expand peer macros for multi-binding variables#3394
raisulchowdhury wants to merge 1 commit into
swiftlang:mainfrom
raisulchowdhury:fix/3320-peer-macro-multibinding

Conversation

@raisulchowdhury

Copy link
Copy Markdown

Summary

Fixes #3320.

Peer macros attached to a multi-binding variable are applied to each binding
independently by the compiler, but macro test support rejected the declaration
before invoking the macro. Expand peer macros once per binding and add
top-level and member regression coverage while retaining the accessor-macro
restriction.

Validation

  • SKIP_LONG_TESTS=1 swift test --filter PeerMacroTests.testPeerMacroOnVariableWithMultipleBindings
  • SKIP_LONG_TESTS=1 swift test --filter SwiftSyntaxMacroExpansionTest
  • strict Swift formatting lint
  • git diff --check

AI assistance

AI assistance was used for investigation and drafting. I compared the test
support behavior with compiler semantics, reviewed the expansion contract and
complete diff, and independently reran the focused regression and formatting
checks.

Apply peer macros once per binding to match compiler behavior and retain diagnostics for accessor macros. Fixes swiftlang#3320.

Signed-off-by: raisulchowdhury <34920788+raisulchowdhury@users.noreply.github.com>
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.

assertMacroExpansion() gives different diagnostics than using a macro when attached to multiple variables

1 participant