Commit 229e49f
authored
[ty] Fix instance-attribute lookup in methods of protocol classes (astral-sh#24213)
## Summary
Our existing `@Todo` type for the meta-type of protocols was being
applied too broadly. The intent was only ever to use a `@Todo` type for
`type[P]` when a user had actually written such an annotation in an
annotation expression. This PR makes the situations where we infer this
`@Todo` type much narrower, reflecting the original intent and allowing
us to fix a bunch of TODOs in our test suite.
## Test Plan
mdtests updated1 parent 466167e commit 229e49f
7 files changed
Lines changed: 43 additions & 18 deletions
File tree
- crates
- ruff_benchmark/benches
- ty_python_semantic
- resources/mdtest
- annotations
- type_qualifiers
- src
- types
- infer/builder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
702 | | - | |
| 701 | + | |
703 | 702 | | |
704 | 703 | | |
705 | 704 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1579 | 1579 | | |
1580 | 1580 | | |
1581 | 1581 | | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1582 | 1605 | | |
1583 | 1606 | | |
1584 | 1607 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | | - | |
| 734 | + | |
735 | 735 | | |
736 | 736 | | |
737 | 737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6254 | 6254 | | |
6255 | 6255 | | |
6256 | 6256 | | |
6257 | | - | |
6258 | | - | |
6259 | | - | |
6260 | | - | |
| 6257 | + | |
| 6258 | + | |
6261 | 6259 | | |
6262 | 6260 | | |
6263 | 6261 | | |
| |||
6300 | 6298 | | |
6301 | 6299 | | |
6302 | 6300 | | |
6303 | | - | |
6304 | 6301 | | |
6305 | 6302 | | |
6306 | 6303 | | |
6307 | | - | |
| 6304 | + | |
| 6305 | + | |
| 6306 | + | |
6308 | 6307 | | |
6309 | 6308 | | |
6310 | 6309 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
911 | 917 | | |
912 | 918 | | |
913 | 919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | | - | |
93 | | - | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | 427 | | |
430 | 428 | | |
431 | 429 | | |
| |||
0 commit comments