From 189456d1516144855df43bd6a38afe5cbf91c155 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 29 Apr 2022 17:12:01 -0600 Subject: [PATCH 1/2] Rephrase typing.assert_never docs This change is similar to that in #32069 --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 0de380551c9fb4..3ba686bdafd8f6 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2337,7 +2337,7 @@ Functions and decorators .. function:: assert_never(arg, /) - Assert to the type checker that a line of code is unreachable. + Ask a static type checker to confirm that a line of code is unreachable. Example:: From 414cacac5022821d3fce3cd26604ff001f58cd7b Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 29 Apr 2022 17:28:44 -0600 Subject: [PATCH 2/2] additional reword from alexwaygood --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 3ba686bdafd8f6..e82006caf7e796 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2358,7 +2358,7 @@ Functions and decorators 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 :class:`float`. - For a call to ``assert_never`` to succeed, the inferred type of + For a call to ``assert_never`` to pass type checking, the inferred type of the argument passed in must be the bottom type, :data:`Never`, and nothing else.