Repository navigation
Commit 47ca4c2
authored
Fix various crashes on recursive type variable defaults (#21491)
Fixes #17716
Fixes #20698
Fixes #21128
Fixes #21269
Although the main idea is relatively simple (replace explicit type
variable defaults with `Any` in cases where they would cause infinite
recursion), this required a lot of "plumbing", because:
* We always call `fix_instance()` eagerly and early.
* There are four different cases to handle (classes vs aliases, and old
style vs new style).
* Relevant pieces of information are available in "distant" places (and
I don't want to add any global state).
Some additional notes:
* I clean-up some weirdness with deferral on type variable defaults with
placeholders (especially in type aliases).
* I remove an unwarranted `get_proper_type()` call during semantic
analysis.
* Now we handle rare edge case of unused alias type variables in
`BoolTypeQuery` (possible with new style aliases).
* Type variable defaults should be considered in `__eq__()` to correctly
detect progress.1 parent 37ee432 commit 47ca4c2
12 files changed
Lines changed: 513 additions & 110 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8529 | 8529 | | |
8530 | 8530 | | |
8531 | 8531 | | |
| 8532 | + | |
| 8533 | + | |
| 8534 | + | |
8532 | 8535 | | |
8533 | 8536 | | |
8534 | 8537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4938 | 4938 | | |
4939 | 4939 | | |
4940 | 4940 | | |
4941 | | - | |
| 4941 | + | |
4942 | 4942 | | |
4943 | 4943 | | |
4944 | 4944 | | |
| 4945 | + | |
4945 | 4946 | | |
4946 | 4947 | | |
4947 | 4948 | | |
| |||
5006 | 5007 | | |
5007 | 5008 | | |
5008 | 5009 | | |
5009 | | - | |
5010 | | - | |
5011 | | - | |
5012 | | - | |
5013 | | - | |
5014 | | - | |
5015 | | - | |
5016 | | - | |
5017 | | - | |
5018 | | - | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
5019 | 5018 | | |
| 5019 | + | |
5020 | 5020 | | |
5021 | 5021 | | |
5022 | 5022 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3145 | 3145 | | |
3146 | 3146 | | |
3147 | 3147 | | |
3148 | | - | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
3149 | 3157 | | |
3150 | 3158 | | |
3151 | 3159 | | |
| |||
3160 | 3168 | | |
3161 | 3169 | | |
3162 | 3170 | | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
3163 | 3174 | | |
3164 | 3175 | | |
3165 | 3176 | | |
| |||
3178 | 3189 | | |
3179 | 3190 | | |
3180 | 3191 | | |
| 3192 | + | |
3181 | 3193 | | |
3182 | 3194 | | |
3183 | 3195 | | |
| |||
3655 | 3667 | | |
3656 | 3668 | | |
3657 | 3669 | | |
| 3670 | + | |
3658 | 3671 | | |
3659 | 3672 | | |
3660 | 3673 | | |
| |||
3816 | 3829 | | |
3817 | 3830 | | |
3818 | 3831 | | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
3819 | 3842 | | |
3820 | 3843 | | |
3821 | 3844 | | |
| |||
3877 | 3900 | | |
3878 | 3901 | | |
3879 | 3902 | | |
| 3903 | + | |
3880 | 3904 | | |
3881 | 3905 | | |
3882 | 3906 | | |
| |||
4548 | 4572 | | |
4549 | 4573 | | |
4550 | 4574 | | |
| 4575 | + | |
4551 | 4576 | | |
4552 | 4577 | | |
4553 | 4578 | | |
| |||
4580 | 4605 | | |
4581 | 4606 | | |
4582 | 4607 | | |
| 4608 | + | |
| 4609 | + | |
4583 | 4610 | | |
4584 | 4611 | | |
4585 | 4612 | | |
| |||
0 commit comments