Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-90633: Improve error and docs for typing.assert_never #91720

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 4 commits into from
Apr 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix roles
  • Loading branch information
JelleZijlstra authored Apr 21, 2022
commit a75280c4eb40349c4ad21a72c05788999a3b4731
4 changes: 2 additions & 2 deletions 4 Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2343,12 +2343,12 @@ Functions and decorators

Here, the type annotations allow the type checker to infer that the
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved
last case can never execute, because ``arg`` is either
an :type:`int` or a :type:`str`, and both options are covered by
an :class:`int` or a :class:`str`, and both options are covered by
earlier cases.
If a type checker finds that a call to ``assert_never()`` is
reachable, it will emit an error. For example, if the type annotation
for ``arg`` was instead ``int | str | float``, the type checker would
emit an error pointing out that ``unreachable`` is of type :type:`float`.
emit an error pointing out that ``unreachable`` is of type :class:`float`.
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved

At runtime, this throws an exception when called.

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.