Skip to content

Replace DiagnosticsProviding protocol with concrete type #1327

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
merged 2 commits into from
Feb 8, 2023

Conversation

elizablock
Copy link
Contributor

As discussed in #1318, a nicer design for providing diagnostics via thrown error is to expose a concrete error type:

public struct DiagnosticsError: Error {
  public var diagnostics: [Diagnostic]
}

This soft-asserts in init if none of the diagnostics has severity == .error, and removes the burden from users of creating their own conforming error type just to throw diagnostics.

@elizablock
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Looks good to me.

@elizablock elizablock merged commit 1b5fe6b into swiftlang:main Feb 8, 2023
@elizablock elizablock deleted the DiagnosticsError branch February 8, 2023 23:05
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.

2 participants