Repository navigation
Commit 60f104a
authored
In stub files, ty required `@override` on the first overload even when
an implementation was present, while overload validation required the
decorator on the implementation. Honor `@override` on the implementation
whenever one exists, matching Pyright and Pyrefly. Continue using the
first overload when there is no implementation.
The implementation also becomes the location for
`invalid-explicit-override` diagnostics in these stubs.
Fixes astral-sh/ty#4742.
## Test plan
- Checked the reported `.pyi` example, an ellipsis-only minimized
example, and a stub without an implementation using Python 3.13 with all
rules enabled; all passed without diagnostics.
- Compared decorator placement with mypy 2.4.0, Pyright 1.1.414,
basedpyright 1.40.2, and Pyrefly 1.4.0. Pyright, basedpyright, and
Pyrefly honor the implementation's decorator in stubs; mypy rejects stub
overload implementations. All four accept the decorator on the first
overload when no implementation exists.
## Ecosystem report
For head `5690fe75333fb6755662fda0cec8d6a192905d2b`, the ecosystem run
removes 27 false `missing-override-decorator` errors from pyochain stubs
whose overload implementations already have `@override`. All changes
were reproduced and classified as expected; CI passed and no ecosystem
concern blocks review. [Full ecosystem
report](#29470 (comment)).
1 parent 207ec3a commit 60f104a
2 files changed
Lines changed: 37 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1028 | 1028 | | |
1029 | 1029 | | |
1030 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1031 | 1055 | | |
1032 | 1056 | | |
1033 | 1057 | | |
| |||
1399 | 1423 | | |
1400 | 1424 | | |
1401 | 1425 | | |
1402 | | - | |
1403 | | - | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
1404 | 1429 | | |
1405 | 1430 | | |
1406 | 1431 | | |
| |||
1426 | 1451 | | |
1427 | 1452 | | |
1428 | 1453 | | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
1429 | 1460 | | |
1430 | 1461 | | |
1431 | 1462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
1895 | | - | |
| 1895 | + | |
1896 | 1896 | | |
1897 | 1897 | | |
1898 | 1898 | | |
| |||
1917 | 1917 | | |
1918 | 1918 | | |
1919 | 1919 | | |
1920 | | - | |
1921 | 1920 | | |
1922 | 1921 | | |
1923 | | - | |
| 1922 | + | |
1924 | 1923 | | |
1925 | 1924 | | |
1926 | 1925 | | |
| |||
2026 | 2025 | | |
2027 | 2026 | | |
2028 | 2027 | | |
2029 | | - | |
2030 | | - | |
2031 | | - | |
2032 | | - | |
2033 | | - | |
2034 | | - | |
| 2028 | + | |
2035 | 2029 | | |
2036 | 2030 | | |
2037 | 2031 | | |
2038 | 2032 | | |
2039 | 2033 | | |
2040 | 2034 | | |
2041 | 2035 | | |
2042 | | - | |
2043 | 2036 | | |
2044 | 2037 | | |
2045 | | - | |
| 2038 | + | |
2046 | 2039 | | |
2047 | 2040 | | |
2048 | 2041 | | |
| |||
0 commit comments