-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Eagerly validate search paths #12783
Conversation
f751f13
to
54b5f0b
Compare
|
60568d5
to
099162a
Compare
let search_path = SearchPath::extra(system, path)?; | ||
files.try_add_root( | ||
db.upcast(), | ||
search_path.as_system_path().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't forgotten about the unwrap
. I addressed it in the following PR. I think this PR even added a few more as_system_path().unwrap()
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
crates/red_knot_python_semantic/src/module_resolver/resolver.rs
Outdated
Show resolved
Hide resolved
099162a
to
7b9da87
Compare
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Summary
This PR moves from a lazy search path validation and makes it eagerly so that Red Knot fails to start if the settings are incorrect.
The main change is that this PR removes
ModuleResolutionSettings
and instead stores the "resolved"SearchPaths
directly onProgram
. Program gets a newProgram::from_settings(db, settings)
function that returns an error if any setting has an invalid value.Test Plan
cargo test