Skip to content

[Macros] Unpack DiagnosticsError into separate diagnostics #64745

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

@DougGregor DougGregor commented Mar 29, 2023

  • Explanation: When a macro throws a DiagnosticsError, which can bundle together multiple diagnostics, make sure to "unpack" those into separate diagnostics. We were flattening them into one error diagnostic that lots all of the specific locations / highlights / Fix-Its of the originals.
  • Scope: Only affects macros that produce diagnostics.
  • Issue: rdar://107289985.
  • Risk: Very low; it's replacing some bespoke code with the use of a common entry point.
  • Testing: Additional tests added.
  • Reviewer: @bnbarham
  • Main branch PR: [Macros] Unpack DiagnosticsError into separate diagnostics #64744

@DougGregor DougGregor requested a review from a team as a code owner March 29, 2023 22:31
@DougGregor
Copy link
Member Author

@swift-ci please test

Rather than open-coding the mapping of thrown errors to diagnostics,
use `MacroExpansionContext.addDiagnostics`. It already does the right
thing.
@DougGregor DougGregor force-pushed the macros-unpack-diagnosticserror-5.9 branch from 64c7c13 to 71974f1 Compare March 30, 2023 21:11
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit 0fb7f8f into swiftlang:release/5.9 Mar 31, 2023
@DougGregor DougGregor deleted the macros-unpack-diagnosticserror-5.9 branch March 31, 2023 03:03
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants