Commit 33030b3
[ty] linear variance inference for PEP-695 type parameters (#18713)
## Summary
Implement linear-time variance inference for type variables
(astral-sh/ty#488).
Inspired by Martin Huschenbett's [PyCon 2025
Talk](https://www.youtube.com/watch?v=7uixlNTOY4s&t=9705s).
## Test Plan
update tests, add new tests, including for mutually recursive classes
---------
Co-authored-by: Carl Meyer <carl@astral.sh>1 parent 656fc33 commit 33030b3
File tree
12 files changed
+1088
-95
lines changed- crates/ty_python_semantic
- resources/mdtest
- generics/pep695
- narrow
- src
- types
12 files changed
+1088
-95
lines changedLines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
| 247 | + | |
| 248 | + | |
244 | 249 | | |
245 | 250 | | |
246 | 251 | | |
| |||
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| 262 | + | |
| 263 | + | |
257 | 264 | | |
258 | 265 | | |
259 | 266 | | |
| |||
266 | 273 | | |
267 | 274 | | |
268 | 275 | | |
| 276 | + | |
| 277 | + | |
269 | 278 | | |
270 | 279 | | |
271 | 280 | | |
| |||
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
| 293 | + | |
| 294 | + | |
284 | 295 | | |
285 | 296 | | |
286 | 297 | | |
| |||
292 | 303 | | |
293 | 304 | | |
294 | 305 | | |
| 306 | + | |
| 307 | + | |
295 | 308 | | |
296 | 309 | | |
297 | 310 | | |
| |||
378 | 391 | | |
379 | 392 | | |
380 | 393 | | |
| 394 | + | |
| 395 | + | |
381 | 396 | | |
382 | 397 | | |
383 | 398 | | |
| |||
395 | 410 | | |
396 | 411 | | |
397 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
398 | 417 | | |
399 | 418 | | |
400 | 419 | | |
| |||
0 commit comments