Commit 269e7ee
authored
Avoid false
Fixes #14771
The mentioned issue's `except: assert_never` examples are already fixed
by #15995. This PR only targets the "no unreachable else" examples.
Introducing the special-purpose attribute
`IfStmt.else_irrelevant_for_possibly_undefined` is not super nice, but
it appears more straightforward and less risky than starting to
introduce empty else blocks with `is_unreachable = True` (as discussed
[here](#13926 (comment))).possibly-undefined errors due to omitted unrequired else statements. (#20149)1 parent 041aa5d commit 269e7ee
File tree
4 files changed
+41
-6
lines changed- mypy
- test-data/unit
4 files changed
+41
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5070 | 5070 | | |
5071 | 5071 | | |
5072 | 5072 | | |
| 5073 | + | |
| 5074 | + | |
5073 | 5075 | | |
5074 | 5076 | | |
5075 | 5077 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1832 | 1832 | | |
1833 | 1833 | | |
1834 | 1834 | | |
1835 | | - | |
| 1835 | + | |
1836 | 1836 | | |
1837 | | - | |
| 1837 | + | |
1838 | 1838 | | |
1839 | 1839 | | |
1840 | 1840 | | |
1841 | 1841 | | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
1842 | 1848 | | |
1843 | 1849 | | |
1844 | 1850 | | |
1845 | 1851 | | |
1846 | 1852 | | |
1847 | 1853 | | |
| 1854 | + | |
1848 | 1855 | | |
1849 | 1856 | | |
1850 | 1857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
404 | 404 | | |
| 405 | + | |
| 406 | + | |
405 | 407 | | |
406 | 408 | | |
407 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1054 | 1054 | | |
1055 | 1055 | | |
1056 | 1056 | | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
0 commit comments