Commit f518cc9
authored
[ty] Allow partially stringified
## Summary
Allow partially stringified `type["ForwardRef"]` annotations, even if
they are not explicitly allowed by the typing spec. The implementation
here follows what we do in e.g. `infer_string_type_expression`.
closes astral-sh/ty#3244
## Ecosystem
We apparently get rid of a prevalent `@Todo` type, so we see new
diagnostics, but nothing that looks like *new* false positives, related
to this change. A lot of ecosystem hits have an ignore-comment for
another type checker, which is generally a good signal.
## Test Plan
* New Markdown tests
* Verified that it fixes the problem in
astral-sh/ty#3244type[…] annotations (#24518)1 parent 16c4090 commit f518cc9
3 files changed
Lines changed: 92 additions & 12 deletions
File tree
- crates/ty_python_semantic
- resources/mdtest
- narrow
- type_of
- src/types/infer/builder
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
230 | 231 | | |
231 | 232 | | |
232 | 233 | | |
| |||
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 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 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
158 | 243 | | |
159 | 244 | | |
160 | 245 | | |
| |||
496 | 581 | | |
497 | 582 | | |
498 | 583 | | |
| 584 | + | |
| 585 | + | |
Lines changed: 4 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1091 | 1091 | | |
1092 | 1092 | | |
1093 | 1093 | | |
1094 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1095 | 1097 | | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
| 1098 | + | |
1106 | 1099 | | |
1107 | 1100 | | |
1108 | 1101 | | |
| |||
1193 | 1186 | | |
1194 | 1187 | | |
1195 | 1188 | | |
1196 | | - | |
1197 | 1189 | | |
1198 | 1190 | | |
1199 | 1191 | | |
| |||
0 commit comments