Skip to content

[docs] improvements for assertionFailure and preconditionFailure #59330

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

glessard
Copy link
Contributor

@glessard glessard commented Jun 8, 2022

  • the previous docs for assertionFailure implies that it is a nonreturning function; that has never been the case.
  • the example usage previously given for assertionFailure was moved to preconditionFailure, where it is more appropriate.

Resolves rdar://94296845 (FB10032237)

- the previous docs for assertionFailure implies that it is a nonreturning function, which has always been wrong.
- the example usage previously given for assertionFailure was moved to preconditionFailure, where it is more appropriate.
@glessard
Copy link
Contributor Author

glessard commented Jun 8, 2022

@swift-ci please smoke test

@glessard glessard marked this pull request as ready for review June 8, 2022 21:43
@glessard glessard requested a review from lorentey June 8, 2022 22:13
Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

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

Looks good!

(Is it weird that we don't expose a way to spell _conditionallyUnreachable? Seems like it would be occasionally very useful, although it's also a potential footgun. 🤔)

@glessard
Copy link
Contributor Author

glessard commented Jun 10, 2022

I agree that _conditionallyUnreachable would often be what is meant, but preconditionFailure is a nearly as lightweight way to do the same thing, with less footgunness.

@glessard glessard merged commit 4dffe27 into swiftlang:main Jun 10, 2022
@glessard glessard deleted the rdar94296845-assertionFailure-docs branch June 10, 2022 19:15
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