fix: expand peer macros for multi-binding variables - #3394
Open
raisulchowdhury wants to merge 1 commit into
Open
fix: expand peer macros for multi-binding variables#3394raisulchowdhury wants to merge 1 commit into
raisulchowdhury wants to merge 1 commit into
Conversation
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>
raisulchowdhury
requested review from
hamishknight,
hborla and
rintaro
as code owners
July 31, 2026 23:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.testPeerMacroOnVariableWithMultipleBindingsSKIP_LONG_TESTS=1 swift test --filter SwiftSyntaxMacroExpansionTestgit diff --checkAI 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.