File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ and is also present in ``typing_extensions`` starting at version 4.1.
86
86
However, it is also possible to define a similar function in your own
87
87
code, for example if you want to customize the runtime error message.
88
88
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 ``.
96
+
89
97
You can also use ``assert_never() `` with a sequence of ``if `` statements:
90
98
91
99
.. code :: python
You can’t perform that action at this time.
0 commit comments