mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Consider nested interface module paths in src_dir
This commit is contained in:
parent
a6d99aa357
commit
9cc658119e
1 changed files with 34 additions and 1 deletions
|
@ -1136,7 +1136,40 @@ impl<'a> LoadStart<'a> {
|
|||
);
|
||||
|
||||
match res_loaded {
|
||||
Ok(good) => good,
|
||||
Ok((module_id, msg)) => match &msg {
|
||||
Msg::Header(ModuleHeader {
|
||||
module_id: header_id,
|
||||
module_name,
|
||||
module_path,
|
||||
is_root_module,
|
||||
..
|
||||
}) => {
|
||||
debug_assert_eq!(*header_id, module_id);
|
||||
debug_assert!(is_root_module);
|
||||
|
||||
match &module_name {
|
||||
ModuleNameEnum::Interface(name) => {
|
||||
// Interface modules can have names like Foo.Bar.Baz,
|
||||
// in which case we need to adjust the src_dir to
|
||||
// remove the "Bar/Baz" directories in order to correctly
|
||||
// resolve this interface module's imports!
|
||||
let dirs_to_pop = name.as_str().matches('.').count();
|
||||
|
||||
if dirs_to_pop > 0 {
|
||||
for _ in 0..dirs_to_pop {
|
||||
src_dir.pop();
|
||||
}
|
||||
|
||||
(module_id, msg)
|
||||
} else {
|
||||
(module_id, msg)
|
||||
}
|
||||
}
|
||||
_ => (module_id, msg),
|
||||
}
|
||||
}
|
||||
_ => (module_id, msg),
|
||||
},
|
||||
|
||||
Err(LoadingProblem::ParsingFailed(problem)) => {
|
||||
let module_ids = Arc::try_unwrap(arc_modules)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue