Commit 952f159
authored
Document unreachability handling of
There is a special case about unreachability, `return NotImplemented`,
which we did not until now mention, which we hereby now mention in the
documentation of `--warn-unreachable`.
I also add a test to test this claimed behavior thoroughly. The current
test tests its desired behavior, in a class, but the actual behavior of
mypy is much broader than that, and applies all the time, it seems.
Fixes #20462. That issue is not
correct anymore, as it was obsoleted by
#20488. However, during its
discussion @sterliakov brought up this `NotImplemented` edge case as
something that should be documented. I think the documentation after
this PR will be satisfactory by everyone's standards.
Similarly, this PR closes #20558.
Theoretically, there could be further special cases of unreachability of
which I am not aware, but these can be noted by later PRs if so.return NotImplemented (#20561)1 parent 7285830 commit 952f159
File tree
2 files changed
+18
-2
lines changed- docs/source
- test-data/unit
2 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
| 540 | + | |
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
547 | 549 | | |
548 | 550 | | |
549 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1639 | 1639 | | |
1640 | 1640 | | |
1641 | 1641 | | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
1642 | 1656 | | |
1643 | 1657 | | |
1644 | 1658 | | |
| |||
0 commit comments