Commit 0f4e0fb
authored
Always re-process annotations refering to an alias on update (#13759)
This should fix a crash discovered by `mypy_primer` in
#13516
The logic here is that when type aliases have placeholders they are
updated _in place_ (the node gets a new resolved target type). But this
means that some variables annotated with type aliases may not get stored
types, unless we defer targets where they are defined.
This didn't cause troubles before, because we waited for type alias to
be complete before putting it into symbol table. Now it is not possible,
we need to put something into symbol table for partially complete
aliases to support recursive aliases (similar to recursive classes).
Also, it was tricky to come up with a repro for this issue, because when
it happens, the variable gets a "silent" `Any` type, and only when it
appears in a dataclass, it causes a crash.1 parent ef22444 commit 0f4e0fb
2 files changed
+21
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3032 | 3032 | | |
3033 | 3033 | | |
3034 | 3034 | | |
| 3035 | + | |
3035 | 3036 | | |
3036 | 3037 | | |
3037 | 3038 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1913 | 1913 | | |
1914 | 1914 | | |
1915 | 1915 | | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
0 commit comments