Skip to content

Commit

Permalink
red-knot: move symbol lookups in symbol.rs (#16152)
Browse files Browse the repository at this point in the history
## Summary

This PR does the following:
* Moves the following from `types.rs` in `symbol.rs`:
	* `symbol`
	* `global_symbol`
	* `imported_symbol`
	* `symbol_from_bindings`
	* `symbol_from_declarations`
	* `SymbolAndQualifiers`
	* `SymbolFromDeclarationsResult`
* Moves the following from `stdlib.rs` in `symbol.rs` and removes
`stdlib.rs`:
	* `known_module_symbol`
	* `builtins_symbol`
	* `typing_symbol` (only for tests)
	* `typing_extensions_symbol`
	* `builtins_module_scope`
	* `core_module_scope`
* Add `symbol_from_bindings_impl` and `symbol_from_declarations_impl` to
keep `RequiresExplicitReExport` an implementation detail
* Make `declaration_type` a `pub(crate)` as it's required in
`symbol_from_declarations` (`binding_type` is already `pub(crate)`

The main motivation is to keep the implementation details private and
only expose an ergonomic API which uses sane defaults for various
scenario to avoid any mistakes from the caller. Refer to
#16133 (comment),
#16133 (comment) for
details.
  • Loading branch information
dhruvmanila authored Feb 17, 2025
1 parent 9304fdf commit 9f111ea
Show file tree
Hide file tree
Showing 6 changed files with 663 additions and 623 deletions.
1 change: 0 additions & 1 deletion crates/red_knot_python_semantic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ mod python_platform;
pub mod semantic_index;
mod semantic_model;
pub(crate) mod site_packages;
mod stdlib;
mod suppression;
pub(crate) mod symbol;
pub mod types;
Expand Down
50 changes: 0 additions & 50 deletions crates/red_knot_python_semantic/src/stdlib.rs

This file was deleted.

Loading

0 comments on commit 9f111ea

Please sign in to comment.