Commit 74927d5
authored
Fixes #19641, but also reveals a test that was only passing by
coincidence. This inference has never worked correctly:
```python
from typing import Mapping, Never
d: dict[Never, Never]
def run() -> Mapping[str, int]:
return d
```
As discussed, I updated the test to expect failure in that case. We
should only special-case inline collection literals for that, everything
else (including locals) can cause undesired false negatives.
1 parent 766c43c commit 74927d5
File tree
5 files changed
+34
-8
lines changed- mypy
- test
- test-data/unit
5 files changed
+34
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
119 | | - | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
155 | | - | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1236 | 1236 | | |
1237 | 1237 | | |
1238 | 1238 | | |
1239 | | - | |
| 1239 | + | |
1240 | 1240 | | |
1241 | 1241 | | |
1242 | | - | |
| 1242 | + | |
1243 | 1243 | | |
1244 | 1244 | | |
1245 | 1245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
756 | 770 | | |
757 | 771 | | |
758 | 772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3781 | 3781 | | |
3782 | 3782 | | |
3783 | 3783 | | |
| 3784 | + | |
| 3785 | + | |
| 3786 | + | |
| 3787 | + | |
3784 | 3788 | | |
3785 | 3789 | | |
| 3790 | + | |
| 3791 | + | |
| 3792 | + | |
| 3793 | + | |
3786 | 3794 | | |
3787 | | - | |
| 3795 | + | |
3788 | 3796 | | |
3789 | 3797 | | |
3790 | 3798 | | |
| |||
0 commit comments