[ty] Check method definitions on subclasses for Liskov violations by AlexWaygood · Pull Request #21436 · astral-sh/ruff (original) (raw)
added the ty
Multi-file analysis & type inference
label
dcreager added a commit that referenced this pull request
We're seeing flaky test failures on macos, which seems to be caused by different Salsa ID orderings on the different platforms. Constraint set BDDs order their internal nodes based on the Salsa IDs of the interned typevar structs, and we had some code that depended on variable ordering in an unexpected way.
This patch definitely fixes the macos test failure on #21414, and hopefully fixes it on #21436, too.
Co-authored-by: Carl Meyer carl@astral.sh
dcreager added a commit that referenced this pull request
- origin/main: (27 commits)
[ty] Add hint about resolved Python version when a user attempts to import a member added on a newer version (#21615)
Use release commit for actions/checkout (#21610)
[ty] Add failing mdtest for known
Protocolpanic (#21594) [parser] Fix panic when parsing IPython escape command expressions (#21480) Fix cargo shear in CI (#21609) Update actions/checkout digest to c2d88d3 (#21601) Update dependency ruff to v0.14.6 (#21603) Update astral-sh/setup-uv action to v7.1.4 (#21602) Update Rust crate clap to v4.5.53 (#21604) Update taiki-e/install-action action to v2.62.56 (#21608) Update Rust crate hashbrown to v0.16.1 (#21605) Update Rust crate indexmap to v2.12.1 (#21606) Update Rust crate syn to v2.0.111 (#21607) [ty] Check method definitions on subclasses for Liskov violations (#21436) [ty] Fix panic for unclosed string literal in type annotation position (#21592) [ty] Fix rendering of unused suppression diagnostic (#21580) [ty] Improve lsp handling of hover/goto on imports (#21572) [ty] Improve diagnostics when a submodule is not available as an attribute on a module-literal type (#21561) [ty] Improve concise diagnostics for invalid exceptions when a user catches a tuple of objects (#21578) [ty] upgrade salsa (#21575) ...
dcreager added a commit that referenced this pull request
…d-typevar
- origin/main: (30 commits)
[ty] Double click to insert inlay hint (#21600)
[ty] Switch the error code from
unresolved-attributetopossibly-missing-attributefor submodules that may not be available (#21618) [ty] Substitute fortyping.Selfwhen checking protocol members (#21569) [ty] Don't suggest things that aren't subclasses ofBaseExceptionafterraise[ty] Add hint about resolved Python version when a user attempts to import a member added on a newer version (#21615) Use release commit for actions/checkout (#21610) [ty] Add failing mdtest for knownProtocolpanic (#21594) [parser] Fix panic when parsing IPython escape command expressions (#21480) Fix cargo shear in CI (#21609) Update actions/checkout digest to c2d88d3 (#21601) Update dependency ruff to v0.14.6 (#21603) Update astral-sh/setup-uv action to v7.1.4 (#21602) Update Rust crate clap to v4.5.53 (#21604) Update taiki-e/install-action action to v2.62.56 (#21608) Update Rust crate hashbrown to v0.16.1 (#21605) Update Rust crate indexmap to v2.12.1 (#21606) Update Rust crate syn to v2.0.111 (#21607) [ty] Check method definitions on subclasses for Liskov violations (#21436) [ty] Fix panic for unclosed string literal in type annotation position (#21592) [ty] Fix rendering of unused suppression diagnostic (#21580) ...
AlexWaygood added a commit that referenced this pull request
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
KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request
…s (#21598)
Summary
Building on astral-sh/ruff#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})