Skip to content

[6.1] DiagnosticEngine: Fix escalation for wrapped diagnostics #78517

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

AnthonyLatsis
Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis commented Jan 9, 2025

This change addresses the following issue: when an error is being
wrapped in a warning, the diagnostic message will use the wrapper's
`DiagGroupID` as the warning's name. However, we want to retain the
original error's group for use. For example, in Swift 5,
`async_unavailable_decl` is wrapped in `error_in_future_swift_version`.
When we print a diagnostic of this kind, we want to keep the
`DiagGroupID` of `async_unavailable_decl`, not that of
`error_in_future_swift_version`.

To achieve this, we add `DiagGroupID` to the `Diagnostic` class. When an
active diagnostic is wrapped in `DiagnosticEngine`, we retain the
original `DiagGroupID`.
@AnthonyLatsis AnthonyLatsis requested a review from a team as a code owner January 9, 2025 14:50
Wrapped diagnostics were not escalated to errors because the check was
based on the diagnostic ID, which is that of the wrapper diagnostic in
this case. Switch to tracking whether escalation was enabled for a given
group instead.
@AnthonyLatsis AnthonyLatsis force-pushed the micronecta-scholtzi-6.1 branch from f1a4647 to 6517bce Compare January 9, 2025 14:53
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please test

@AnthonyLatsis AnthonyLatsis merged commit ab9c378 into swiftlang:release/6.1 Jan 9, 2025
5 checks passed
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.

3 participants