mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Error when platform package config cannot be found
This avoid compiler hangs that occurred before Closes #1822
This commit is contained in:
parent
8633cedf4d
commit
f28ca65ac5
3 changed files with 42 additions and 23 deletions
|
@ -1217,6 +1217,10 @@ impl<'a> LoadStart<'a> {
|
|||
let buf = to_parse_problem_report(problem, module_ids, root_exposed_ident_ids);
|
||||
return Err(LoadingProblem::FormattedReport(buf));
|
||||
}
|
||||
Err(LoadingProblem::FileProblem { filename, error }) => {
|
||||
let buf = to_file_problem_report(&filename, error);
|
||||
return Err(LoadingProblem::FormattedReport(buf));
|
||||
}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
};
|
||||
|
@ -1367,7 +1371,7 @@ where
|
|||
|
||||
// We need to allocate worker *queues* on the main thread and then move them
|
||||
// into the worker threads, because those workers' stealers need to be
|
||||
// shared bet,een all threads, and this coordination work is much easier
|
||||
// shared between all threads, and this coordination work is much easier
|
||||
// on the main thread.
|
||||
let mut worker_queues = bumpalo::collections::Vec::with_capacity_in(num_workers, arena);
|
||||
let mut stealers = bumpalo::collections::Vec::with_capacity_in(num_workers, arena);
|
||||
|
@ -1745,7 +1749,7 @@ fn update<'a>(
|
|||
state.module_cache.module_names.insert(*id, name.clone());
|
||||
}
|
||||
|
||||
// This was a dependency. Write it down and keep processing messaages.
|
||||
// This was a dependency. Write it down and keep processing messages.
|
||||
let mut exposed_symbols: MutSet<Symbol> =
|
||||
HashSet::with_capacity_and_hasher(header.exposes.len(), default_hasher());
|
||||
|
||||
|
@ -2638,7 +2642,10 @@ fn parse_header<'a>(
|
|||
Msg::Many(vec![app_module_header_msg, load_pkg_config_msg]),
|
||||
))
|
||||
} else {
|
||||
Ok((module_id, app_module_header_msg))
|
||||
Err(LoadingProblem::FileProblem {
|
||||
filename: pkg_config_roc,
|
||||
error: io::ErrorKind::NotFound.into(),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
panic!("could not find base")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
app "primary"
|
||||
packages { blah: "./blah" }
|
||||
interface Primary
|
||||
exposes [ blah2, blah3, str, alwaysThree, identity, z, w, succeed, withDefault, yay ]
|
||||
imports [ Dep1, Dep2.{ two, foo }, Dep3.Blah.{ bar }, Res ]
|
||||
provides [ blah2, blah3, str, alwaysThree, identity, z, w, succeed, withDefault, yay ] to blah
|
||||
|
||||
blah2 = Dep2.two
|
||||
blah3 = bar
|
||||
|
|
|
@ -82,11 +82,6 @@ mod test_load {
|
|||
let app_module = files.pop().unwrap();
|
||||
let interfaces = files;
|
||||
|
||||
debug_assert!(
|
||||
app_module.1.starts_with("app"),
|
||||
"The final module should be the application module"
|
||||
);
|
||||
|
||||
for (name, source) in interfaces {
|
||||
let mut filename = PathBuf::from(name);
|
||||
filename.set_extension("roc");
|
||||
|
@ -278,15 +273,10 @@ mod test_load {
|
|||
"Main",
|
||||
indoc!(
|
||||
r#"
|
||||
app "test-app"
|
||||
packages { blah: "./blah" }
|
||||
imports [ RBTree ]
|
||||
provides [ main ] to blah
|
||||
interface Other exposes [ empty ] imports [ RBTree ]
|
||||
|
||||
empty : RBTree.RedBlackTree I64 I64
|
||||
empty = RBTree.empty
|
||||
|
||||
main = empty
|
||||
"#
|
||||
),
|
||||
),
|
||||
|
@ -530,7 +520,7 @@ mod test_load {
|
|||
"Main",
|
||||
indoc!(
|
||||
r#"
|
||||
app "test-app" packages { blah: "./blah" } provides [ main ] to blah
|
||||
interface Main exposes [ main ] imports []
|
||||
|
||||
main = [
|
||||
"#
|
||||
|
@ -561,9 +551,7 @@ mod test_load {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(
|
||||
expected = "FileProblem { filename: \"tests/fixtures/build/interface_with_deps/invalid$name.roc\", error: NotFound }"
|
||||
)]
|
||||
#[should_panic(expected = "FILE NOT FOUND")]
|
||||
fn file_not_found() {
|
||||
let subs_by_module = MutMap::default();
|
||||
let loaded_module = load_fixture("interface_with_deps", "invalid$name", subs_by_module);
|
||||
|
@ -589,4 +577,29 @@ mod test_load {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_does_not_exist() {
|
||||
let modules = vec![(
|
||||
"Main",
|
||||
indoc!(
|
||||
r#"
|
||||
app "example"
|
||||
packages { pf: "./zzz-does-not-exist" }
|
||||
imports [ ]
|
||||
provides [ main ] to pf
|
||||
|
||||
main = ""
|
||||
"#
|
||||
),
|
||||
)];
|
||||
|
||||
match multiple_modules(modules) {
|
||||
Err(report) => {
|
||||
assert!(report.contains("FILE NOT FOUND"));
|
||||
assert!(report.contains("zzz-does-not-exist/Package-Config.roc"));
|
||||
}
|
||||
Ok(_) => unreachable!("we expect failure here"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue