Skip to content

Remove #expect(throws: Never.self) and #require(throws: Never.self) as distinct overloads. #661

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 4, 2024

#expect(throws: Never.self) and #require(throws: Never.self) do not need to be specified as separate overloads. This PR removes them as distinct symbols:

  • The documentation for #expect(throws: Never.self) is merged into the documentation for #expect(throws:).
  • The diagnostic emitted when using #require(throws: Never.self) is lowered from a deprecation warning to a macro-generated custom warning.

This change has no other compile-time or runtime effects: code that passes Never.self to either macro will continue to compile, and macros cannot be referenced so there is no risk of source-level breakage like there might be from a function signature change.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…)` as distinct overloads.

`#expect(throws: Never.self)` and `#require(throws: Never.self)` do not need to
be specified as separate overloads. This PR removes them as distinct symbols:

- The documentation for `#expect(throws: Never.self)` is merged into the
  documentation for `#expect(throws:)`.
- The diagnostic emitted when using `#require(throws: Never.self)` is lowered
  from a deprecation warning to a macro-generated custom warning.

This change has no other compile-time or runtime effects: code that passes
`Never.self` to either macro will continue to compile, and macros cannot be
referenced so there is no risk of source-level breakage like there might be from
a function signature change.
@grynspan grynspan added documentation 📚 Improvements or additions to documentation enhancement New feature or request public-api Affects public API swift-6.1 labels Sep 4, 2024
@grynspan grynspan self-assigned this Sep 4, 2024
@grynspan
Copy link
Contributor Author

grynspan commented Sep 4, 2024

@swift-ci test

@grynspan grynspan merged commit 9de9084 into main Sep 4, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/remove-expect-throws-never-overload branch September 4, 2024 22:07
@grynspan grynspan added this to the Swift 6.1 milestone Sep 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation 📚 Improvements or additions to documentation enhancement New feature or request public-api Affects public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants