Skip to content

Commit 02883f7

Browse files
Update docs/guides/unreachable.rst: commit suggestion
Co-authored-by: Sebastian Rittau <[email protected]>
1 parent bad7ee2 commit 02883f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/guides/unreachable.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ and is also present in ``typing_extensions`` starting at version 4.1.
8686
However, it is also possible to define a similar function in your own
8787
code, for example if you want to customize the runtime error message.
8888

89-
This use of match statements for comprehensive matching is common enough that some typecheckers have direct support for checking all match statements for exhaustiveness, regardless of whether or not they have an assert_never-style function in their default arm. For instance, in pyright this can be enabled by enabling the diagnostic code reportMatchNotExhaustive (on by default in strict mode), and in mypy it can be enabled by enabling the error code exhaustive-match.
89+
This use of match statements for comprehensive matching is common
90+
enough that some typecheckers have direct support for checking all match
91+
statements for exhaustiveness, regardless of whether or not they have an
92+
``assert_never``-style function in their default arm. For instance, in pyright
93+
this can be enabled by enabling the diagnostic code ``reportMatchNotExhaustive``
94+
(on by default in strict mode), and in mypy it can be enabled by enabling
95+
the error code ``exhaustive-match``.
9096

9197
You can also use ``assert_never()`` with a sequence of ``if`` statements:
9298

0 commit comments

Comments
 (0)