Commit 45aa599
authored
Do not abort constructing TypeAlias if only type parameters hold us back. (#20162)
Fixes #20135.
I am not fully certain that this is the right way. If the type alias can
be reasonably constructed and only type parameters prevent that, we can
create an "almost" equivalent alias with all placeholder-bearing
typevars replaced with their "simple" equivalents with default
values/bound/default values. This would cause current iteration to not
emit some parameterization errors later, but, since we already defer the
alias as a whole, we will recheck all of them again.
This obviously adds some pointless work (we check parameterization that
will not be used later), but probably is not that big of a deal,
recursive aliases are relatively rare in wild. If this turns out to be a
bottleneck, we can add a `parameters_ready` flag to aliases and skip the
heavy parts if it is False, but I think it isn't necessary now.1 parent 9ed7bb4 commit 45aa599
File tree
3 files changed
+78
-4
lines changed- mypy
- test-data/unit
3 files changed
+78
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5637 | 5637 | | |
5638 | 5638 | | |
5639 | 5639 | | |
5640 | | - | |
5641 | | - | |
| 5640 | + | |
5642 | 5641 | | |
5643 | 5642 | | |
5644 | 5643 | | |
5645 | 5644 | | |
5646 | 5645 | | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
5647 | 5654 | | |
5648 | 5655 | | |
5649 | 5656 | | |
| |||
5677 | 5684 | | |
5678 | 5685 | | |
5679 | 5686 | | |
5680 | | - | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
5681 | 5691 | | |
5682 | 5692 | | |
5683 | 5693 | | |
| |||
5707 | 5717 | | |
5708 | 5718 | | |
5709 | 5719 | | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
5710 | 5760 | | |
5711 | 5761 | | |
5712 | 5762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2057 | 2057 | | |
2058 | 2058 | | |
2059 | 2059 | | |
| 2060 | + | |
2060 | 2061 | | |
2061 | 2062 | | |
2062 | 2063 | | |
| |||
2168 | 2169 | | |
2169 | 2170 | | |
2170 | 2171 | | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
0 commit comments