Commit 0e6cfd4
authored
Unify handling of self attributes in daemon (#21025)
There are two situations that require special handling in the daemon:
* When we have an attribute _defined_ on `self` in a method.
* When a variable defined in class body is _inferred_ using an
assignment in a method.
The first one is an old thing that is handled with so called "saved
attributes", while the second is a recent addition handled by including
relevant methods in the top-level target. Two different mechanisms with
subtle differences for two similar situations make it hard to reason
about what is going on in the daemon. And it will be even more
complicated when we will add "staggered" interface/implementation
type-checking in parallel checking, that will need to handle these
situations as well.
Although this PR is strictly speaking not required for parallel
checking, I propose to unify all four quadrants in the (defined variable
vs inferred variable type) x (parallel checking vs daemon) square under
the same mechanism: have a _single_ flag on a function/method that
specifies that this function/method may affect interface of the module,
and thus should be _always_ processed as a part of the module top-level.
This is a relatively significant change in the daemon, but IMO it is
(much) cleaner, and we will probably need to rip off this band-aid
sooner or later anyway. I didn't do this in my initial implementation of
partial `None` type support, because I didn't want to touch the daemon
more than strictly necessary (as I did in some of my other recent PRs),
but now it seems to me that doing so creates too much tech-debt to
address later.1 parent 7ff36ef commit 0e6cfd4
File tree
6 files changed
+92
-142
lines changed- mypy
- server
6 files changed
+92
-142
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | | - | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| |||
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | 458 | | |
461 | 459 | | |
462 | 460 | | |
| |||
719 | 717 | | |
720 | 718 | | |
721 | 719 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | 720 | | |
736 | 721 | | |
737 | 722 | | |
738 | | - | |
| 723 | + | |
739 | 724 | | |
740 | 725 | | |
741 | 726 | | |
| |||
1211 | 1196 | | |
1212 | 1197 | | |
1213 | 1198 | | |
1214 | | - | |
| 1199 | + | |
1215 | 1200 | | |
1216 | 1201 | | |
1217 | 1202 | | |
| |||
1452 | 1437 | | |
1453 | 1438 | | |
1454 | 1439 | | |
1455 | | - | |
1456 | | - | |
| 1440 | + | |
1457 | 1441 | | |
1458 | 1442 | | |
1459 | 1443 | | |
| |||
5620 | 5604 | | |
5621 | 5605 | | |
5622 | 5606 | | |
5623 | | - | |
| 5607 | + | |
5624 | 5608 | | |
5625 | 5609 | | |
5626 | 5610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
659 | 660 | | |
660 | 661 | | |
661 | 662 | | |
662 | | - | |
| 663 | + | |
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
| |||
680 | 681 | | |
681 | 682 | | |
682 | 683 | | |
683 | | - | |
684 | | - | |
| 684 | + | |
| 685 | + | |
685 | 686 | | |
686 | 687 | | |
687 | 688 | | |
| |||
691 | 692 | | |
692 | 693 | | |
693 | 694 | | |
694 | | - | |
| 695 | + | |
695 | 696 | | |
696 | 697 | | |
697 | 698 | | |
| |||
1035 | 1036 | | |
1036 | 1037 | | |
1037 | 1038 | | |
1038 | | - | |
1039 | 1039 | | |
1040 | 1040 | | |
1041 | 1041 | | |
| |||
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
1077 | | - | |
1078 | | - | |
1079 | 1077 | | |
1080 | 1078 | | |
1081 | 1079 | | |
| |||
5089 | 5087 | | |
5090 | 5088 | | |
5091 | 5089 | | |
| 5090 | + | |
| 5091 | + | |
| 5092 | + | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
| 5100 | + | |
| 5101 | + | |
| 5102 | + | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
5092 | 5110 | | |
5093 | 5111 | | |
5094 | 5112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
375 | | - | |
| 376 | + | |
376 | 377 | | |
377 | 378 | | |
378 | 379 | | |
| |||
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
500 | | - | |
501 | | - | |
502 | 501 | | |
503 | 502 | | |
504 | 503 | | |
| |||
981 | 980 | | |
982 | 981 | | |
983 | 982 | | |
984 | | - | |
| 983 | + | |
985 | 984 | | |
986 | 985 | | |
987 | | - | |
| 986 | + | |
988 | 987 | | |
989 | 988 | | |
990 | 989 | | |
| |||
1272 | 1271 | | |
1273 | 1272 | | |
1274 | 1273 | | |
1275 | | - | |
| 1274 | + | |
1276 | 1275 | | |
1277 | 1276 | | |
1278 | 1277 | | |
1279 | 1278 | | |
1280 | 1279 | | |
1281 | 1280 | | |
1282 | | - | |
| 1281 | + | |
1283 | 1282 | | |
1284 | 1283 | | |
1285 | 1284 | | |
| |||
1809 | 1808 | | |
1810 | 1809 | | |
1811 | 1810 | | |
1812 | | - | |
1813 | | - | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
1814 | 1814 | | |
1815 | 1815 | | |
1816 | 1816 | | |
| |||
4602 | 4602 | | |
4603 | 4603 | | |
4604 | 4604 | | |
4605 | | - | |
| 4605 | + | |
4606 | 4606 | | |
4607 | 4607 | | |
4608 | 4608 | | |
| |||
4687 | 4687 | | |
4688 | 4688 | | |
4689 | 4689 | | |
4690 | | - | |
4691 | | - | |
| 4690 | + | |
4692 | 4691 | | |
4693 | 4692 | | |
4694 | 4693 | | |
4695 | 4694 | | |
4696 | 4695 | | |
4697 | 4696 | | |
4698 | 4697 | | |
4699 | | - | |
| 4698 | + | |
4700 | 4699 | | |
4701 | 4700 | | |
4702 | 4701 | | |
| |||
7566 | 7565 | | |
7567 | 7566 | | |
7568 | 7567 | | |
7569 | | - | |
| 7568 | + | |
7570 | 7569 | | |
7571 | 7570 | | |
7572 | 7571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
| 131 | + | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
137 | | - | |
| 136 | + | |
138 | 137 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | 138 | | |
144 | 139 | | |
145 | 140 | | |
146 | 141 | | |
147 | 142 | | |
148 | | - | |
149 | 143 | | |
150 | 144 | | |
151 | 145 | | |
| |||
160 | 154 | | |
161 | 155 | | |
162 | 156 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 157 | | |
188 | 158 | | |
189 | 159 | | |
| |||
240 | 210 | | |
241 | 211 | | |
242 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
243 | 216 | | |
244 | 217 | | |
245 | 218 | | |
| |||
0 commit comments