Skip to content

[Macros] Centralize "unwrapping" of errors into diagnostics #1471

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

We had a few different implementations of "take an error thrown from a
macro and turn it into diagnostics". Improve the implementation in
MacroExpansionContext.addDiagnostics to properly handle both
DiagnosticsError and DiagnosticsMessage, as well as fall back
gracefully if either of those is missing an error diagnostic. Then,
use that implementation for the compiler plugin message handler.

Another part of fixing rdar://107289985, where diagnostics provided by
throwing DiagnosticsError aren't coming through well.

We had a few different implementations of "take an error thrown from a
macro and turn it into diagnostics". Improve the implementation in
`MacroExpansionContext.addDiagnostics` to properly handle both
`DiagnosticsError` and `DiagnosticsMessage`, as well as fall back
gracefully if either of those is missing an error diagnostic. Then,
use that implementation for the compiler plugin message handler.

Another part of fixing rdar://107289985, where diagnostics provided by
throwing `DiagnosticsError` aren't coming through well.
@DougGregor DougGregor requested a review from ahoppen as a code owner March 30, 2023 22:04
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit 548c9a9 into swiftlang:release/5.9 Mar 31, 2023
@DougGregor DougGregor deleted the macro-context-add-diags-5.9 branch March 31, 2023 03:03
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