-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Extend Liskov checks to also cover classmethods and staticmethods #21598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-method-override |
687 | 0 | 0 |
unused-ignore-comment |
0 | 45 | 0 |
| Total | 687 | 45 | 0 |
|
I skimmed the new diagnostics and couldn't see any obvious false positives. A lot of them are, once again, us being more pedantic than other type checkers when it comes to subclasses changing the names of parameters -- but as before, it's very hard for us to put those in a different error code until we're able to propagate through |
.../snapshots/liskov.md_-_The_Liskov_Substitut…_-_Staticmethods_and_cl…_(49e28aae6fdd1291).snap
Outdated
Show resolved
Hide resolved
5c2ba94 to
29ea12a
Compare
29ea12a to
40a9abf
Compare
* main: [ty] Extend Liskov checks to also cover classmethods and staticmethods (astral-sh#21598) Dogfood ty on the `scripts` directory (astral-sh#21617) [ty] support generic aliases in `type[...]`, like `type[C[int]]` (astral-sh#21552) [ty] Retain the function-like-ness of `Callable` types when binding `self` (astral-sh#21614) [ty] Distinguish "unconstrained" from "constrained to any type" (astral-sh#21539) Disable ty workspace diagnostics for VSCode users (astral-sh#21620) [ty] Double click to insert inlay hint (astral-sh#21600) [ty] Switch the error code from `unresolved-attribute` to `possibly-missing-attribute` for submodules that may not be available (astral-sh#21618) [ty] Substitute for `typing.Self` when checking protocol members (astral-sh#21569) [ty] Don't suggest things that aren't subclasses of `BaseException` after `raise` [ty] Add hint about resolved Python version when a user attempts to import a member added on a newer version (astral-sh#21615)
Summary
Building on #21436.
There's nothing conceptually more complicated about this, it just requires its own set of tests and its own subdiagnostic hint.
I also uncovered another inconsistency between mypy/pyright/pyrefly, which is fun. In this case, I suggest we go with pyright's behaviour.
Test Plan
mdtests/snapshots