Commit 401798f
authored
Correctly support self types in callable ClassVar (#14115)
Fixes #14108
This fixes both new and old style of working with self types. After all
I fixed the new style by simply expanding self type, then `bind_self()`
does its job, so effect on the instance will be the same.
I had two options fixing this, other one (that I didn't go with) is
making the callable generic in new style, if it appears in `ClassVar`.
This however has two downsides: implementation is tricky, and this adds
and edge case to an existing edge case. So instead I choose internal
consistency within the new style, rather than similarity between old and
new style.1 parent 823667d commit 401798f
File tree
3 files changed
+36
-12
lines changed- mypy
- test-data/unit
3 files changed
+36
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
770 | 773 | | |
771 | 774 | | |
772 | 775 | | |
| |||
960 | 963 | | |
961 | 964 | | |
962 | 965 | | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
968 | 971 | | |
969 | 972 | | |
970 | 973 | | |
| |||
978 | 981 | | |
979 | 982 | | |
980 | 983 | | |
981 | | - | |
| 984 | + | |
982 | 985 | | |
983 | 986 | | |
984 | 987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3236 | 3236 | | |
3237 | 3237 | | |
3238 | 3238 | | |
3239 | | - | |
| 3239 | + | |
3240 | 3240 | | |
3241 | | - | |
3242 | 3241 | | |
3243 | 3242 | | |
3244 | | - | |
| 3243 | + | |
3245 | 3244 | | |
3246 | 3245 | | |
3247 | 3246 | | |
| |||
3250 | 3249 | | |
3251 | 3250 | | |
3252 | 3251 | | |
3253 | | - | |
| 3252 | + | |
3254 | 3253 | | |
3255 | | - | |
| 3254 | + | |
3256 | 3255 | | |
3257 | 3256 | | |
3258 | 3257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1750 | 1750 | | |
1751 | 1751 | | |
1752 | 1752 | | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
0 commit comments