Skip to content
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

[red-knot] Respect typeshed's VERSIONS file when resolving stdlib modules #12141

Merged
merged 62 commits into from
Jul 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7380511
Everything finally compiles
AlexWaygood Jun 29, 2024
75a140a
Move `ModuleName` into a new file
AlexWaygood Jun 29, 2024
8cd568c
Specify that the `Db` must allow typeshed versions to be queried
AlexWaygood Jun 29, 2024
eb6a377
The supported Python version is set at the same time as the search paths
AlexWaygood Jun 29, 2024
87419ce
`TypeshedVersions` returns a three-variant enum
AlexWaygood Jul 1, 2024
5d30cf8
Silly implementation for the `todo!()`s
AlexWaygood Jul 1, 2024
5c1f4e8
Implementation that actually looks at the target version we set
AlexWaygood Jul 1, 2024
1a82d21
Address easy review comments
AlexWaygood Jul 1, 2024
d91626c
Get rid of a lot of boilerplate
AlexWaygood Jul 2, 2024
1dc038e
Cleanup
AlexWaygood Jul 2, 2024
9e1ae5e
Merge branch 'main' into custom-typeshed-versions
AlexWaygood Jul 2, 2024
583e503
Make some public methods private
AlexWaygood Jul 2, 2024
906d801
Inline some simple helper methods
AlexWaygood Jul 2, 2024
ed088e3
Use Salsa queries to load `TypeshedVersions`
AlexWaygood Jul 2, 2024
dbe8826
fix test
AlexWaygood Jul 2, 2024
0a0a334
Address easy review comments
AlexWaygood Jul 3, 2024
ad2e987
Cleanup VERSIONS-parsing and add a todo for better error handling
AlexWaygood Jul 3, 2024
78c56f7
Move more logic internal to `path.rs`
AlexWaygood Jul 3, 2024
6723c7f
Get rid of the inner structs
AlexWaygood Jul 3, 2024
9ba9ac1
Bye bye `DoubleEndedIterator`
AlexWaygood Jul 3, 2024
9c556ba
Add tests for some helpers
AlexWaygood Jul 3, 2024
9c672f8
Simplify `ModulePartIterator`
AlexWaygood Jul 3, 2024
ad3bd7a
more tests
AlexWaygood Jul 3, 2024
21e60fe
fix Windows?
AlexWaygood Jul 3, 2024
76f5b3f
fix Windows???
AlexWaygood Jul 3, 2024
116f8f9
Add tests for `relativize_path`
AlexWaygood Jul 4, 2024
5ecc0f3
Add tests for `is_directory()` and `is_regular_package()`
AlexWaygood Jul 4, 2024
dde1393
Merge branch 'main' into custom-typeshed-versions
AlexWaygood Jul 4, 2024
c541dd0
Delete cruft from older tests
AlexWaygood Jul 4, 2024
2f0d349
Add tests for the resolver as a whole with `VERSIONS`
AlexWaygood Jul 4, 2024
9bbe5a8
More unit tests in `path.rs`
AlexWaygood Jul 4, 2024
e505b68
Merge branch 'main' into custom-typeshed-versions
AlexWaygood Jul 4, 2024
36b9288
Reduce use of `is_none()` in tests
AlexWaygood Jul 5, 2024
2f0d562
Add more todos for `into_ordered_search_paths()`
AlexWaygood Jul 5, 2024
86ee754
Merge branch 'main' into custom-typeshed-versions
AlexWaygood Jul 5, 2024
ea58e3a
Typeshed versions are looked up from the cache once per module resolu…
AlexWaygood Jul 5, 2024
8dda2e3
Move test-only methods into `test` submodules
AlexWaygood Jul 5, 2024
7efd84c
Elide some lifetimes
AlexWaygood Jul 5, 2024
553ce67
Delete and streamline some trait implementations
AlexWaygood Jul 5, 2024
9fda47a
Remove unnecessary `*`s
AlexWaygood Jul 5, 2024
b819680
Make `ModuleResolutionPathBuf::push()` assert invariants on release b…
AlexWaygood Jul 5, 2024
7eebb75
Reduce nesting in `ModuleName::from_components()`
AlexWaygood Jul 5, 2024
470f0c6
Document `TypeshedVersionsQueryResult` variants
AlexWaygood Jul 5, 2024
d4c11ee
Docs for `query_module()`
AlexWaygood Jul 5, 2024
b0c49c2
Add a `create_resolver_test()` helper
AlexWaygood Jul 5, 2024
55538bb
Fix `Debug` implementations
AlexWaygood Jul 5, 2024
a65c4dc
Get rid of `stdlib_path_test_case()` helper
AlexWaygood Jul 5, 2024
884c57b
Share more code between some methods in `path.rs`
AlexWaygood Jul 5, 2024
13e741e
Split up some tests in `resolver.rs`
AlexWaygood Jul 5, 2024
70cd43b
Reduce diff in `resolver.rs` tests
AlexWaygood Jul 5, 2024
82a9974
Split up a big test in `versions.rs`
AlexWaygood Jul 5, 2024
5f5ad70
Simplify tests in `path.rs`
AlexWaygood Jul 5, 2024
640d2fa
Small cleanup in `path.rs`
AlexWaygood Jul 5, 2024
4c7a106
Getting the target version is no longer a separate Salsa query
AlexWaygood Jul 5, 2024
777ec7d
`db` is now always the first argument
AlexWaygood Jul 5, 2024
f8e900e
Get rid of unneeded new dependency
AlexWaygood Jul 5, 2024
8fc3a7d
So many lifetimes
AlexWaygood Jul 5, 2024
b848415
Rename some things
AlexWaygood Jul 5, 2024
daf64b4
Audit docs in `resolver.rs`
AlexWaygood Jul 5, 2024
47c3467
Make assertions in `push()` make a little more sense
AlexWaygood Jul 5, 2024
401779b
Encapsulate all state passed around in a single struct
AlexWaygood Jul 5, 2024
38128e0
Add a TODO for better distinctions between absolute and relative paths
AlexWaygood Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a TODO for better distinctions between absolute and relative paths
  • Loading branch information
AlexWaygood committed Jul 5, 2024
commit 38128e036fd9d6a1887683c8f7d03fdc4da69a28
4 changes: 4 additions & 0 deletions crates/red_knot_module_resolver/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/// Internal abstractions for differentiating between different kinds of search paths.
///
/// TODO(Alex): Should we use different types for absolute vs relative paths?
/// <https://github.com/astral-sh/ruff/pull/12141#discussion_r1667010245>
use std::fmt;

use ruff_db::file_system::{FileSystemPath, FileSystemPathBuf};
Expand Down
Loading