Skip to content

Commit

Permalink
[red-knot] Use a distinct type for module search paths in the module …
Browse files Browse the repository at this point in the history
…resolver (#12379)
  • Loading branch information
AlexWaygood authored Jul 22, 2024
1 parent ea2d51c commit 2a8f95c
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 311 deletions.
10 changes: 5 additions & 5 deletions crates/red_knot_module_resolver/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ruff_db::files::File;

use crate::db::Db;
use crate::module_name::ModuleName;
use crate::path::{ModuleResolutionPathBuf, ModuleResolutionPathRef};
use crate::path::ModuleSearchPath;

/// Representation of a Python module.
#[derive(Clone, PartialEq, Eq)]
Expand All @@ -17,7 +17,7 @@ impl Module {
pub(crate) fn new(
name: ModuleName,
kind: ModuleKind,
search_path: Arc<ModuleResolutionPathBuf>,
search_path: ModuleSearchPath,
file: File,
) -> Self {
Self {
Expand All @@ -41,8 +41,8 @@ impl Module {
}

/// The search path from which the module was resolved.
pub(crate) fn search_path(&self) -> ModuleResolutionPathRef {
ModuleResolutionPathRef::from(&*self.inner.search_path)
pub(crate) fn search_path(&self) -> &ModuleSearchPath {
&self.inner.search_path
}

/// Determine whether this module is a single-file module or a package
Expand Down Expand Up @@ -77,7 +77,7 @@ impl salsa::DebugWithDb<dyn Db> for Module {
struct ModuleInner {
name: ModuleName,
kind: ModuleKind,
search_path: Arc<ModuleResolutionPathBuf>,
search_path: ModuleSearchPath,
file: File,
}

Expand Down
Loading

0 comments on commit 2a8f95c

Please sign in to comment.